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

Commit

Permalink
cleaning up the pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer committed Aug 23, 2014
1 parent ce21246 commit 672e65a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 672e65a

Please sign in to comment.