Exemple #1
0
        private IClassDeclaration ImplementINotifyPropertyChangedInterface(IClassDeclaration viewModel, IClassDeclaration wrappedClass)
        {
            UsingDirectiveHelper.AddUsingDirectiveIfNeeded(wrappedClass, "System", "ComponentModel");

            IConstructLanguage language   = viewModel.Language;
            IIdentifier        identifier = language.Identifier(PropertyChangedSimpleTypeName);
            ITypeName          typeName   = language.SimpleTypeName(identifier, language.None <ITypeArguments>());

            viewModel.IntroduceInterface(typeName);

            wrappedClass.Append(viewModel);
            string name = viewModel.Identifier.Name;

            viewModel = RebuildSolutionModel(wrappedClass, name);

            AddStubsHelper.CreateAllUnimplementedMembers(viewModel, new AddStubsOptions());

            return(RebuildSolutionModel(wrappedClass, name));
        }