Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit d22ee70

Browse files
fix #249 - SD5 WinForms Designer does not load event handlers.
add missing documentation to DocumentPrinter.cs
1 parent e183540 commit d22ee70

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/DocumentPrinter.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ namespace ICSharpCode.AvalonEdit.Utils
2121
/// </summary>
2222
public static class DocumentPrinter
2323
{
24+
/// <summary>
25+
/// Converts a readonly TextDocument to a Block and applies the provided highlighting definition.
26+
/// </summary>
2427
public static Block ConvertTextDocumentToBlock(ReadOnlyDocument document, IHighlightingDefinition highlightingDefinition)
2528
{
2629
IHighlighter highlighter;
@@ -31,6 +34,9 @@ public static Block ConvertTextDocumentToBlock(ReadOnlyDocument document, IHighl
3134
return ConvertTextDocumentToBlock(document, highlighter);
3235
}
3336

37+
/// <summary>
38+
/// Converts a readonly TextDocument to a Block and applies the provided highlighter.
39+
/// </summary>
3440
public static Block ConvertTextDocumentToBlock(IDocument document, IHighlighter highlighter)
3541
{
3642
if (document == null)
@@ -61,6 +67,9 @@ public static Block ConvertTextDocumentToBlock(IDocument document, IHighlighter
6167
return p;
6268
}
6369

70+
/// <summary>
71+
/// Creates a flow document from the editor's contents.
72+
/// </summary>
6473
public static FlowDocument CreateFlowDocumentForEditor(TextEditor editor)
6574
{
6675
IHighlighter highlighter = editor.TextArea.GetService(typeof(IHighlighter)) as IHighlighter;

src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
using ICSharpCode.NRefactory.PatternMatching;
2828
using ICSharpCode.NRefactory.Semantics;
2929
using ICSharpCode.NRefactory.TypeSystem;
30+
using Mono.CSharp;
3031

3132
namespace ICSharpCode.NRefactory.CSharp
3233
{
@@ -887,6 +888,14 @@ CodeObject IAstVisitor<CodeObject>.VisitExpressionStatement(ExpressionStatement
887888
return new CodeAssignStatement(Convert(unary.Expression), cboe);
888889
}
889890
}
891+
if (assignment != null && assignment.Operator == AssignmentOperatorType.Add) {
892+
var rr = Resolve(assignment.Left);
893+
if (!rr.IsError && rr.Type.Kind == TypeKind.Delegate) {
894+
var expr = (MemberReferenceExpression)assignment.Left;
895+
var memberRef = (CodeEventReferenceExpression)HandleMemberReference(Convert(expr.Target), expr.MemberName, expr.TypeArguments, (MemberResolveResult)rr);
896+
return new CodeAttachEventStatement(memberRef, Convert(assignment.Right));
897+
}
898+
}
890899
return new CodeExpressionStatement(Convert(expressionStatement.Expression));
891900
}
892901

@@ -1260,7 +1269,7 @@ CodeObject IAstVisitor<CodeObject>.VisitSyntaxTree(SyntaxTree syntaxTree)
12601269
var cn = cu.Namespaces [j];
12611270
bool found = cn.Imports
12621271
.Cast<CodeNamespaceImport> ()
1263-
.Any (ns => ns.Namespace == gi.Namespace);
1272+
.Any (ns => ns.Namespace == gi.Namespace);
12641273
if (!found)
12651274
cn.Imports.Add (gi);
12661275
}

0 commit comments

Comments
 (0)