From 672e65a01072d89264d4ad2938317889c55b701a Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 23 Aug 2014 21:35:24 +0200 Subject: [PATCH] cleaning up the pull request --- .../Project/Src/FormsDesigner/CSharpDesignerGenerator.cs | 7 ++++++- .../Project/Src/FormsDesigner/SecondaryDisplayBinding.cs | 7 ------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpDesignerGenerator.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpDesignerGenerator.cs index fc6b3484944..6b68df5d3cb 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpDesignerGenerator.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpDesignerGenerator.cs @@ -298,7 +298,12 @@ string GenerateField(CodeMemberField newField) void CreateField(CodeMemberField newField) { // insert new field below the last field or InitializeComponents() - var field = FormsDesignerSecondaryDisplayBinding.GetLastField(formClass, initializeComponents.BodyRegion.FileName); + IField field = null; + if (formClass != null) { + field = formClass.Fields.LastOrDefault(f => string.Equals(f.Region.FileName, + initializeComponents.Region.FileName, + StringComparison.OrdinalIgnoreCase)); + } var bodyRegion = field != null ? field.BodyRegion : initializeComponents.BodyRegion; DocumentScript script = GetScript(bodyRegion.FileName); string newline = DocumentUtilities.GetLineTerminator(script.OriginalDocument, bodyRegion.BeginLine); diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/SecondaryDisplayBinding.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/SecondaryDisplayBinding.cs index bd3bd0fc3bf..ee4287e6bc5 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/SecondaryDisplayBinding.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/SecondaryDisplayBinding.cs @@ -55,13 +55,6 @@ public static IMethod GetInitializeComponents(ITypeDefinition c) } return null; } - - public static IField GetLastField(ITypeDefinition c, string fileNmae) - { - if (c == null) - return null; - return c.Fields.LastOrDefault(field => field.BodyRegion.FileName == fileNmae); - } public static bool BaseClassIsFormOrControl(ITypeDefinition c) {