コード例 #1
0
        private void AddPropertyChangedMember(TextDocument classFile, LanguageElement classExpression)
        {
            Statement statement;

            if (CodeRush.Language.IsCSharp)
            {
                statement = new Statement("public event PropertyChangedEventHandler PropertyChanged = delegate {}");
            }
            else if (CodeRush.Language.IsBasic)
            {
                statement = new SnippetCodeStatement("Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged", false);
            }
            else
            {
                statement = new Statement(string.Empty);
            }
            SourceRange newEventRange = classFile.InsertText(new SourcePoint(classExpression.EndLine, 1), "\n" + CodeRush.Language.GenerateElement(statement));

            classFile.Format(newEventRange);
        }
コード例 #2
0
 private void AddPropertyChangedMember(TextDocument classFile, LanguageElement classExpression)
 {
     Statement statement;
     if (CodeRush.Language.IsCSharp)
     {
         statement = new Statement("public event PropertyChangedEventHandler PropertyChanged = delegate {}");
     }
     else if (CodeRush.Language.IsBasic)
     {
         statement = new SnippetCodeStatement("Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged",false);
     }
     else
     {
         statement = new Statement(string.Empty);
     }
     SourceRange newEventRange = classFile.InsertText(new SourcePoint(classExpression.EndLine - 1,1), "\n"+CodeRush.Language.GenerateElement(statement));
     classFile.Format(newEventRange);
 }