Ejemplo n.º 1
0
        public AsyncConverterConfigureAwaitPage([NotNull] Lifetime lifetime, [NotNull] OptionsSettingsSmartContext store,
                                                IPromptWinForm promptWinForms)
            : base(lifetime, store)
        {
            AddHeader("In class and method will be ignored ConfigureAwait suggestion");
            var editItemViewModelFactory = new DefaultCollectionEditItemViewModelFactory(null);
            var buttonProviderFactory    = new DefaultButtonProviderFactory(lifetime, promptWinForms, editItemViewModelFactory);
            var attributeTypes           = new StringCollectionEditViewModel(lifetime, "Attributes:",
                                                                             buttonProviderFactory, editItemViewModelFactory);

            foreach (var type in store.EnumIndexedValues(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes))
            {
                attributeTypes.AddItem(type);
            }

            attributeTypes.Items.CollectionChanged += (o, e) =>
            {
                foreach (
                    var entryIndex in
                    OptionsSettingsSmartContext.EnumEntryIndices(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes)
                    .ToArray())
                {
                    OptionsSettingsSmartContext.RemoveIndexedValue(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes,
                                                                   entryIndex);
                }
                foreach (
                    var editItemViewModel in
                    attributeTypes.Items)
                {
                    OptionsSettingsSmartContext.SetIndexedValue(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes,
                                                                editItemViewModel.PresentableName, editItemViewModel.PresentableName);
                }
            };
            AddCustomOption(attributeTypes);
        }
Ejemplo n.º 2
0
        public AsyncSuffixOptionsPage([NotNull] Lifetime lifetime, [NotNull] OptionsSettingsSmartContext store,
                                      IWindowsHookManager windowsHookManager, FormValidators formValidators, IUIApplication iuiApplication)
            : base(lifetime, store)
        {
            AddHeader("Tests");
            AddBoolOption(
                (AsyncSuffixSettings options) => options.ExcludeTestMethodsFromAnalysis,
                "Exclude test methods from analysis");
            var editItemViewModelFactory = new DefaultCollectionEditItemViewModelFactory(null);
            var buttonProviderFactory    = new DefaultButtonProviderFactory(lifetime, windowsHookManager, formValidators,
                                                                            iuiApplication, editItemViewModelFactory);
            var customAsyncTypes = new StringCollectionEditViewModel(lifetime, "Treat these types as async:",
                                                                     buttonProviderFactory, editItemViewModelFactory);

            store.EnumEntryIndices(AsyncSuffixSettingsAccessor.CustomAsyncTypes)
            .ToArray()
            .ForEach(x => customAsyncTypes.AddItem(x));
            customAsyncTypes.Items.CollectionChanged += (o, e) =>
            {
                foreach (
                    var entryIndex in
                    OptionsSettingsSmartContext.EnumEntryIndices(AsyncSuffixSettingsAccessor.CustomAsyncTypes)
                    .ToArray())
                {
                    OptionsSettingsSmartContext.RemoveIndexedValue(AsyncSuffixSettingsAccessor.CustomAsyncTypes,
                                                                   entryIndex);
                }
                foreach (
                    var editItemViewModel in
                    customAsyncTypes.Items)
                {
                    OptionsSettingsSmartContext.SetIndexedValue(AsyncSuffixSettingsAccessor.CustomAsyncTypes,
                                                                editItemViewModel.PresentableName, editItemViewModel.PresentableName);
                }
            };
            AddHeader("Custom types");
            AddCustomOption(customAsyncTypes);
        }
 public AsyncSuffixOptionsPage([NotNull] Lifetime lifetime, [NotNull] OptionsSettingsSmartContext store,
     IWindowsHookManager windowsHookManager, FormValidators formValidators, IUIApplication iuiApplication)
     : base(lifetime, store)
 {
     AddHeader("Tests");
     AddBoolOption(
         (AsyncSuffixSettings options) => options.ExcludeTestMethodsFromAnalysis,
         "Exclude test methods from analysis");
     var editItemViewModelFactory = new DefaultCollectionEditItemViewModelFactory(null);
     var buttonProviderFactory = new DefaultButtonProviderFactory(lifetime, windowsHookManager, formValidators,
         iuiApplication, editItemViewModelFactory);
     var customAsyncTypes = new StringCollectionEditViewModel(lifetime, "Treat these types as async:",
         buttonProviderFactory, editItemViewModelFactory);
     store.EnumEntryIndices(AsyncSuffixSettingsAccessor.CustomAsyncTypes)
         .ToArray()
         .ForEach(x => customAsyncTypes.AddItem(x));
     customAsyncTypes.Items.CollectionChanged += (o, e) =>
     {
         foreach (
             var entryIndex in
                 OptionsSettingsSmartContext.EnumEntryIndices(AsyncSuffixSettingsAccessor.CustomAsyncTypes)
                     .ToArray())
         {
             OptionsSettingsSmartContext.RemoveIndexedValue(AsyncSuffixSettingsAccessor.CustomAsyncTypes,
                 entryIndex);
         }
         foreach (
             var editItemViewModel in
                 customAsyncTypes.Items)
         {
             OptionsSettingsSmartContext.SetIndexedValue(AsyncSuffixSettingsAccessor.CustomAsyncTypes,
                 editItemViewModel.PresentableName, editItemViewModel.PresentableName);
         }
     };
     AddHeader("Custom types");
     AddCustomOption(customAsyncTypes);
 }