public LogExceptionsToDatabase(
     IUIServiceWpf uiService,
     PickExceptionStep exceptionStep,
     SelectDatabaseStep databaseStep)
     : this(uiService, new IWizardStep[] { exceptionStep, databaseStep })
 {
 }
 public SaveMergedEnvironmentConfigurationCommand(IUIServiceWpf uiService, ConfigurationSourceModel configurationSource, IApplicationModel application, ElementViewModel overridesViewModel)
     : base(uiService)
 {
     this.configurationSource = configurationSource;
     this.application = application;
     this.overridesViewModel = (EnvironmentSourceViewModel)overridesViewModel;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddSatelliteProviderCommand"/> class.
 /// </summary>
 /// <remarks>
 /// This class is intended to be initialized by the <see cref="SectionViewModel.CreateElementCollectionAddCommands"/>.
 /// </remarks>
 /// <param name="commandAttribute">The <see cref="AddSateliteProviderCommandAttribute"/> that specifes metadata for this <see cref="AddSatelliteProviderCommand"/> to be initialized with.</param>
 /// <param name="collection"></param>
 /// <param name="commandService"></param>
 /// <param name="configurationElementType"></param>
 /// <param name="lookup"></param>
 /// <param name="uiService"></param>
 public AddSatelliteProviderCommand(AddSateliteProviderCommandAttribute commandAttribute, MenuCommandService commandService, ConfigurationElementType configurationElementType, ElementCollectionViewModel collection, ElementLookup lookup, IUIServiceWpf uiService)
     : base(commandAttribute, configurationElementType, collection, uiService)
 {
     this.commandService = commandService;
     this.commandAttribute = commandAttribute;
     this.lookup = lookup;
 }
 public SaveMergedEnvironmentConfigurationCommand(IUIServiceWpf uiService, ConfigurationSourceModel configurationSource, IApplicationModel application, ElementViewModel overridesViewModel)
     : base(uiService)
 {
     this.configurationSource = configurationSource;
     this.application         = application;
     this.overridesViewModel  = (EnvironmentSourceViewModel)overridesViewModel;
 }
        ///<summary>
        /// Imports a protected key from a file and updates a <see cref="ProtectedKeySettings"/> structure with the imported values.
        ///</summary>
        ///<param name="uiService">The user-interface service for displaying messages and windows to the user.</param>
        ///<param name="keySettings">The key settings structure to update.</param>
        public static void ImportProtectedKey(IUIServiceWpf uiService, ProtectedKeySettings keySettings)
        {
            string protectedKeyFilename           = keySettings.FileName;
            DataProtectionScope protectedKeyScope = keySettings.Scope;

            if (!File.Exists(protectedKeyFilename))
            {
                var dialogResult = uiService.ShowMessageWpf(
                    string.Format(CultureInfo.CurrentCulture, Resources.MessageboxMessageUnableToLocateCryptoKey, keySettings.FileName),
                    Resources.MessageboxTitleUnableToLocateCryptoKey,
                    System.Windows.MessageBoxButton.YesNo);
                if (dialogResult == System.Windows.MessageBoxResult.Yes)
                {
                    Microsoft.Win32.OpenFileDialog locateCryptoKeyDialog = new Microsoft.Win32.OpenFileDialog
                    {
                        Title = Resources.MessageboxTitleUnableToLocateCryptoKey
                    };

                    var locateFileDislogresult = uiService.ShowFileDialog(locateCryptoKeyDialog);
                    if (true == locateFileDislogresult.DialogResult)
                    {
                        protectedKeyFilename = locateCryptoKeyDialog.FileName;
                    }
                }
            }

            using (Stream keyFileContents = File.OpenRead(protectedKeyFilename))
            {
                var key = KeyManager.Read(keyFileContents, protectedKeyScope);
                keySettings.ProtectedKey = key;
                keySettings.Scope        = protectedKeyScope;
                keySettings.FileName     = protectedKeyFilename;
            }
        }
        public AddRegistrationPropertyCommand(CommandAttribute commandAttribute, ElementCollectionViewModel collection, IApplicationModel applicationModel, DefaultCollectionElementAddCommand defaultAddPropertyCommand, IUIServiceWpf uiService)
            : base(commandAttribute, collection, defaultAddPropertyCommand, uiService)
        {
            this.collection = collection as InjectionMemberCollectionViewModel;

            this.applicationModel = applicationModel;
        }
Example #7
0
        public AddCacheManagerCommand(ElementCollectionViewModel collection, IUIServiceWpf uiService)
            : base(new ConfigurationElementType(typeof(CacheManagerData)), collection, uiService)
        {
            Guard.ArgumentNotNull(collection, "collection");

            this.cachingSection = collection.ContainingSection as CacheManagerSectionViewModel;
        }
        ///<summary>
        /// Imports a protected key from a file and updates a <see cref="ProtectedKeySettings"/> structure with the imported values.
        ///</summary>
        ///<param name="uiService">The user-interface service for displaying messages and windows to the user.</param>
        ///<param name="keySettings">The key settings structure to update.</param>
        public static void ImportProtectedKey(IUIServiceWpf uiService, ProtectedKeySettings keySettings)
        {
            string protectedKeyFilename = keySettings.FileName;
            DataProtectionScope protectedKeyScope = keySettings.Scope;

            if (!File.Exists(protectedKeyFilename))
            {
                var dialogResult = uiService.ShowMessageWpf(
                                        string.Format(CultureInfo.CurrentCulture, Resources.MessageboxMessageUnableToLocateCryptoKey, keySettings.FileName),
                                        Resources.MessageboxTitleUnableToLocateCryptoKey,
                                        System.Windows.MessageBoxButton.YesNo);
                if (dialogResult == System.Windows.MessageBoxResult.Yes)
                {

                    Microsoft.Win32.OpenFileDialog locateCryptoKeyDialog = new Microsoft.Win32.OpenFileDialog
                    {
                        Title = Resources.MessageboxTitleUnableToLocateCryptoKey
                    };

                    var locateFileDislogresult = uiService.ShowFileDialog(locateCryptoKeyDialog);
                    if (true == locateFileDislogresult.DialogResult)
                    {
                        protectedKeyFilename = locateCryptoKeyDialog.FileName;
                    }
                }
            }

            using (Stream keyFileContents = File.OpenRead(protectedKeyFilename))
            {
                var key = KeyManager.Read(keyFileContents, protectedKeyScope);
                keySettings.ProtectedKey = key;
                keySettings.Scope = protectedKeyScope;
                keySettings.FileName = protectedKeyFilename;
            }
        }
Example #9
0
 public LogExceptionsToDatabase(
     IUIServiceWpf uiService,
     PickExceptionStep exceptionStep,
     SelectDatabaseStep databaseStep)
     : this(uiService, new IWizardStep[] { exceptionStep, databaseStep })
 {
 }
 /// <summary>
 /// Initializes an instance of CommandModel from <see cref="CommandAttribute"/>.
 /// </summary>
 /// <param name="commandAttribute"></param>
 /// <param name="uiService"></param>
 protected CommandModel(CommandAttribute commandAttribute, IUIServiceWpf uiService)
     : this(uiService)
 {
     Title = commandAttribute.Title;
     HelpText = string.Empty;
     Placement = commandAttribute.CommandPlacement;
     ChildCommands = Enumerable.Empty<CommandModel>();
     KeyGesture = commandAttribute.KeyGesture;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddApplicationBlockCommand"/> class.
 /// </summary>
 /// <param name="configurationModel">The <see cref="ConfigurationSourceModel"/> instance that represents the configuration source that is currently edited.</param>
 /// <param name="commandAttribute">The <see cref="AddApplicationBlockCommandAttribute"/> that specifes metadata for this <see cref="AddApplicationBlockCommand"/> to be initialized with.</param>
 /// <param name="uiService"></param>
 public AddApplicationBlockCommand(ConfigurationSourceModel configurationModel, AddApplicationBlockCommandAttribute commandAttribute, IUIServiceWpf uiService)
     : base(commandAttribute, uiService)
 {
     this.configurationModel = configurationModel;
     INotifyCollectionChanged collectionChanged = configurationModel.Sections;
     collectionChanged.CollectionChanged += Sections_CollectionChanged;
     this.sectionName = commandAttribute.SectionName;
     this.configurationSectionType = commandAttribute.ConfigurationSectionType;
 }
 /// <summary>
 /// Initializes an instance of CommandModel from <see cref="CommandAttribute"/>.
 /// </summary>
 /// <param name="commandAttribute"></param>
 /// <param name="uiService"></param>
 protected CommandModel(CommandAttribute commandAttribute, IUIServiceWpf uiService)
     : this(uiService)
 {
     Title         = commandAttribute.Title;
     HelpText      = string.Empty;
     Placement     = commandAttribute.CommandPlacement;
     ChildCommands = Enumerable.Empty <CommandModel>();
     KeyGesture    = commandAttribute.KeyGesture;
 }
 public ExceptionThrowingCommandModel(IUIServiceWpf uiService) :
     base(
     new CommandAttribute(typeof(ExceptionThrowingCommandModel))
         {
             CommandPlacement = CommandPlacement.ContextCustom,
             Title = "ExceptionThrowingCommand"
         },
     uiService)
 {
 }
 /// <summary>
 /// Initializes a new <see cref="ConfigurationSourceModel"/>.
 /// </summary>
 /// <param name="lookup">The <see cref="ElementLookup"/> service used for locating elements.</param>
 /// <param name="viewModelDependency">The <see cref="ConfigurationSourceDependency"/> for notifying others of changes in this configuration source.</param>
 /// <param name="builder">The container for building new objects.</param>
 /// <param name="uiService">The user-interface service for presenting dialogs and windows to the user.</param>
 /// <param name="saveOperation">Save operation integration with a host environment.</param>
 public ConfigurationSourceModel(ElementLookup lookup, ConfigurationSourceDependency viewModelDependency, IUnityContainer builder, IUIServiceWpf uiService, SaveOperation saveOperation)
 {
     this.uiService           = uiService;
     this.builder             = builder;
     this.viewModelDependency = viewModelDependency;
     this.lookup         = lookup;
     this.saveOperation  = saveOperation;
     sections            = new ObservableCollection <SectionViewModel>();
     readOnlySectionView = new ReadOnlyObservableCollection <SectionViewModel>(sections);
 }
 /// <summary>
 /// Initializes a new <see cref="ConfigurationSourceModel"/>.
 /// </summary>
 /// <param name="lookup">The <see cref="ElementLookup"/> service used for locating elements.</param>
 /// <param name="viewModelDependency">The <see cref="ConfigurationSourceDependency"/> for notifying others of changes in this configuration source.</param>
 /// <param name="builder">The container for building new objects.</param>
 /// <param name="uiService">The user-interface service for presenting dialogs and windows to the user.</param>
 /// <param name="saveOperation">Save operation integration with a host environment.</param>
 public ConfigurationSourceModel(ElementLookup lookup, ConfigurationSourceDependency viewModelDependency, IUnityContainer builder, IUIServiceWpf uiService, SaveOperation saveOperation)
 {
     this.uiService = uiService;
     this.builder = builder;
     this.viewModelDependency = viewModelDependency;
     this.lookup = lookup;
     this.saveOperation = saveOperation;
     sections = new ObservableCollection<SectionViewModel>();
     readOnlySectionView = new ReadOnlyObservableCollection<SectionViewModel>(sections);
 }
 public ExceptionThrowingCommandModel(IUIServiceWpf uiService) :
     base(
         new CommandAttribute(typeof(ExceptionThrowingCommandModel))
 {
     CommandPlacement = CommandPlacement.ContextCustom,
     Title            = "ExceptionThrowingCommand"
 },
         uiService)
 {
 }
 public ExportAdmTemplateCommand(CommandAttribute commandAttribute,
                                 ApplicationViewModel applicationViewModel,
                                 IUIServiceWpf uiService,
                                 ElementViewModel element,
                                 AssemblyLocator assemblyLocator)
     : base(commandAttribute, uiService)
 {
     this.applicationViewModel = applicationViewModel;
     this.element            = element;
     this.attributeRetriever = new ConfigurationManageabilityProviderAttributeRetriever(assemblyLocator);
 }
        public TestableWizard(IUIServiceWpf uiService, IEnumerable<WizardStep> steps)
            : base(uiService)
        {
            foreach (var step in steps)
            {
                AddStep(step);
            }

            // default execute action is to call base
            ExecuteAction = () => { BaseExecute(); };
        }
        protected TemplatedInjectionMemberCommandContainerBase(CommandAttribute commandAttribute, ElementCollectionViewModel collection, DefaultCollectionElementAddCommand defaultAddCommand, IUIServiceWpf uiService)
            : base(commandAttribute, uiService)
        {
            this.collection = collection as InjectionMemberCollectionViewModel;
            this.registerElement = collection.ParentElement as RegisterElementViewModel;

            this.defaultAddCommand = defaultAddCommand;

            this.registerElementRegistrationTypeChangedHandler = new EventHandler<EventArgs>(registerElement_RegistrationTypeChanged);
            this.registerElement.RegistrationTypeChanged += registerElementRegistrationTypeChangedHandler;
        }
 public ExportAdmTemplateCommand(CommandAttribute commandAttribute,
                                 ApplicationViewModel applicationViewModel,
                                 IUIServiceWpf uiService,
                                 ElementViewModel element,
                                 AssemblyLocator assemblyLocator)
     : base(commandAttribute, uiService)
 {
     this.applicationViewModel = applicationViewModel;
     this.element = element;
     this.attributeRetriever = new ConfigurationManageabilityProviderAttributeRetriever(assemblyLocator);
 }
Example #21
0
        public TestableWizard(IUIServiceWpf uiService, IEnumerable <WizardStep> steps)
            : base(uiService)
        {
            foreach (var step in steps)
            {
                AddStep(step);
            }

            // default execute action is to call base
            ExecuteAction = () => { BaseExecute(); };
        }
        public SelectValidatedTypeReferenceMembersCommand(TypeMemberChooser typeMemberChooser, ElementViewModel context, CommandAttribute attribute, IUIServiceWpf uiService)
            : base(attribute, uiService)
        {
            if (context.ConfigurationType != typeof(ValidationRulesetData)) throw new InvalidOperationException();

            this.validatedTypeReferenceElement = context.AncestorElements().Where(x => x.ConfigurationType == typeof(ValidatedTypeReference)).First();
            this.fieldCollectionElement = (ElementCollectionViewModel)context.ChildElements.Where(x => x.ConfigurationType == typeof(ValidatedFieldReferenceCollection)).First();
            this.propertyCollectionElement = (ElementCollectionViewModel)context.ChildElements.Where(x => x.ConfigurationType == typeof(ValidatedPropertyReferenceCollection)).First();
            this.methodsCollectionElement = (ElementCollectionViewModel)context.ChildElements.Where(x => x.ConfigurationType == typeof(ValidatedMethodReferenceCollection)).First();

            this.typeMemberChooser = typeMemberChooser;
        }
        public ConfigurationSourceElementDeleteCommand(CommandAttribute commandAttribute, ElementViewModel elementViewModel, IUIServiceWpf uiService)
            : base(commandAttribute, uiService)
        {
            Guard.ArgumentNotNull(elementViewModel, "elementViewModel");

            this.elementViewModel = elementViewModel;
            if (!typeof(ConfigurationSourceElement).IsAssignableFrom(elementViewModel.ConfigurationType))
            {
                throw new ArgumentException(
                    Resources.CommandConfigurationSourceElementDeleteOnWrongType);
            }
        }
        /// <summary>
        /// Initializes a new instance of the WizardCommand.
        /// </summary>
        /// <param name="attribute">The <see cref="WizardCommandAttribute"/> used to define this command.</param>
        /// <param name="uiService">The service to use when displaying dialogs.</param>
        /// <param name="resolver">The service to use to get instances of new <see cref="WizardModel"/> based on <paramref name="attribute"/></param>
        public WizardCommand(WizardCommandAttribute attribute
            , IUIServiceWpf uiService
            , IResolver<WizardModel> resolver)
            : base(attribute, uiService)
        {
            this.resolver = resolver;
            this.attributedClassType = attribute.WizardType;

            if(!typeof(WizardModel).IsAssignableFrom(attributedClassType))
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.InvalidWizardTypeMessage, attributedClassType.Name));
            }
        }
        /// <summary>
        /// Initializes an instance of <see cref="WizardModel"/>.
        /// </summary>
        /// <param name="uiService">The UI service used to display any dialogs the wizard may need.</param>
        protected WizardModel(IUIServiceWpf uiService)
        {
            if (uiService == null)
            {
                throw new ArgumentNullException("uiService");
            }

            this.uiService = uiService;

            nextCommand     = new DelegateCommand((o) => Next(), (o) => NextCanExecute());
            previousCommand = new DelegateCommand((o) => Previous(), (o) => PreviousCanExecute());
            finishCommand   = new DelegateCommand((o) => Finish(), (o) => FinishCanExecute());
        }
        protected LogExceptionsToDatabase(IUIServiceWpf uiService, params IWizardStep[] wizardSteps)
            : base(uiService)
        {
            Guard.ArgumentNotNull(wizardSteps, "wizardSteps");

            foreach (var step in wizardSteps)
            {
                AddStep(step);
            }

            var dictionary = (ResourceDictionary)Application.LoadComponent(ResourcesUri);
            GlobalResources.AddExtendedDictionary(dictionary);
        }
        /// <summary>
        /// Initializes an instance of <see cref="WizardModel"/>.
        /// </summary>
        /// <param name="uiService">The UI service used to display any dialogs the wizard may need.</param>
        protected WizardModel(IUIServiceWpf uiService)
        {
            if (uiService == null)
            {
                throw new ArgumentNullException("uiService");
            }

            this.uiService = uiService;

            nextCommand = new DelegateCommand((o) => Next(), (o) => NextCanExecute());
            previousCommand = new DelegateCommand((o) => Previous(), (o) => PreviousCanExecute());
            finishCommand = new DelegateCommand((o) => Finish(), (o) => FinishCanExecute());
        }
        /// <summary>
        /// Initializes a new instance of the WizardCommand.
        /// </summary>
        /// <param name="attribute">The <see cref="WizardCommandAttribute"/> used to define this command.</param>
        /// <param name="uiService">The service to use when displaying dialogs.</param>
        /// <param name="resolver">The service to use to get instances of new <see cref="WizardModel"/> based on <paramref name="attribute"/></param>
        public WizardCommand(WizardCommandAttribute attribute
                             , IUIServiceWpf uiService
                             , IResolver <WizardModel> resolver)
            : base(attribute, uiService)
        {
            this.resolver            = resolver;
            this.attributedClassType = attribute.WizardType;

            if (!typeof(WizardModel).IsAssignableFrom(attributedClassType))
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.InvalidWizardTypeMessage, attributedClassType.Name));
            }
        }
        public TypePickingCollectionElementAddCommand(IUIServiceWpf uiService, IAssemblyDiscoveryService discoveryService, TypePickingCommandAttribute commandAttribute, ConfigurationElementType configurationElementType, ElementCollectionViewModel elementCollectionModel)
            : base(commandAttribute, configurationElementType, elementCollectionModel, uiService)
        {
            Guard.ArgumentNotNull(commandAttribute, "commandAttribute");

            this.discoveryService = discoveryService;
            this.propertyToSet    = commandAttribute.Property;

            if (propertyToSet == null)
            {
                throw new ArgumentException(
                          "Target ConfigurationElement must have an accessible property named TypeName or a specified property of type string.");
            }
        }
        public TypePickingCollectionElementAddCommand(IUIServiceWpf uiService, IAssemblyDiscoveryService discoveryService, TypePickingCommandAttribute commandAttribute, ConfigurationElementType configurationElementType, ElementCollectionViewModel elementCollectionModel)
            : base(commandAttribute, configurationElementType, elementCollectionModel, uiService)
        {
            Guard.ArgumentNotNull(commandAttribute, "commandAttribute");

            this.discoveryService = discoveryService;
            this.propertyToSet = commandAttribute.Property;

            if (propertyToSet == null)
            {
                throw new ArgumentException(
                    "Target ConfigurationElement must have an accessible property named TypeName or a specified property of type string.");
            }
        }
Example #31
0
        protected LogExceptionsToDatabase(IUIServiceWpf uiService, params IWizardStep[] wizardSteps)
            : base(uiService)
        {
            Guard.ArgumentNotNull(wizardSteps, "wizardSteps");

            foreach (var step in wizardSteps)
            {
                AddStep(step);
            }

            var dictionary = (ResourceDictionary)Application.LoadComponent(ResourcesUri);

            GlobalResources.AddExtendedDictionary(dictionary);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="WellKnownRetryStrategyElementCollectionCommand"/> class. 
        /// </summary>
        /// <param name="collection">The collection that will be affected by the add command.</param>
        /// <param name="uiService"><see cref="IUIServiceWpf"/> for displaying messages.</param>
        public WellKnownRetryStrategyElementCollectionCommand(ElementCollectionViewModel collection, IUIServiceWpf uiService)
            : base(collection, uiService)
        {
            this.section = collection.ContainingSection;

            var knownTypes = new[]
                {
                    typeof(IncrementalData), typeof(FixedIntervalData), typeof(ExponentialBackoffData),
                    typeof(CustomRetryStrategyData)
                };

            this.childCommands = knownTypes
                .SelectMany(x => this.section.CreateCollectionElementAddCommand(x, collection))
                .OrderBy(x => x.Title)
                .ToArray();
        }
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            BindableProperty           bindableProperty = (BindableProperty)context.PropertyDescriptor;
            ElementProperty            property         = (ElementProperty)bindableProperty.Property;
            ElementCollectionViewModel collection       = (ElementCollectionViewModel)property.DeclaringElement.ChildElement(property.DeclaringProperty.Name);
            IUIServiceWpf uiService = (IUIServiceWpf)context.GetService(typeof(IUIServiceWpf));

            PopupCollectionEditorWindow w = new PopupCollectionEditorWindow()
            {
                ContainedContent = new HeaderedListLayout(collection, collection.AddCommands)
            };

            uiService.ShowDialog(w);

            return(value);
        }
        public EnvironmentOverriddenElementProperty(IServiceProvider serviceProvider, IUIServiceWpf uiService, EnvironmentSourceViewModel environmentModel, ElementViewModel subject, EnvironmentOverriddenElementPayload overrides)
            : base(serviceProvider, subject, null, new Attribute[]
        {
            new EnvironmentalOverridesAttribute(false),
            new ResourceCategoryAttribute(typeof(DesignResources), "CategoryOverrides")
        })
        {
            this.uiService   = uiService;
            this.overrides   = overrides;
            this.environment = environmentModel;
            this.converter   = new OverriddenElementViewModelConverter();
            this.overrides   = overrides;
            this.subject     = subject;

            this.environment.PropertyChanged += EnvironmentPropertyChanged;
        }
        public EnvironmentOverriddenElementProperty(IServiceProvider serviceProvider, IUIServiceWpf uiService, EnvironmentSourceViewModel environmentModel, ElementViewModel subject, EnvironmentOverriddenElementPayload overrides)
            : base(serviceProvider, subject, null, new Attribute[]
               {
                   new EnvironmentalOverridesAttribute(false), 
                   new ResourceCategoryAttribute(typeof(DesignResources), "CategoryOverrides")
               })
        {
            this.uiService = uiService;
            this.overrides = overrides;
            this.environment = environmentModel;
            this.converter = new OverriddenElementViewModelConverter();
            this.overrides = overrides;
            this.subject = subject;

            this.environment.PropertyChanged += EnvironmentPropertyChanged;
        }
        ///<summary>
        /// Initializes an instance of DefaultElementCollectionAddCommand.  
        /// </summary>
        ///<param name="collection">The collection that will be affected by the add command.</param>
        ///<param name="uiService"><see cref="IUIServiceWpf"/> for displaying messages.</param>
        public DefaultElementCollectionAddCommand(ElementCollectionViewModel collection, IUIServiceWpf uiService)
            : base(uiService)
        {
            this.collection = collection;
            this.section = collection.ContainingSection;

            if (this.collection.IsPolymorphicCollection)
            {
                childCommands = this.collection.PolymorphicCollectionElementTypes
                                                .SelectMany(x => section.CreateCollectionElementAddCommand(x, collection))
                                                .OrderBy(x => x.Title)
                                                .ToArray();
            }
            else
            {
                childCommands = section.CreateCollectionElementAddCommand(collection.CollectionElementType, collection).ToArray();
            }
        }
        public EnvironmentSourceViewModel(IUnityContainer builder, IUIServiceWpf uiService, ApplicationViewModel sourceModel, ConfigurationSection section)
            : base(builder, EnvironmentalOverridesSection.EnvironmentallyOverriddenProperties, section, new Attribute[] { new EnvironmentalOverridesAttribute(false) })
        {
            this.uiService          = uiService;
            this.environmentSection = (EnvironmentalOverridesSection)section;
            this.elementLookup      = builder.Resolve <ElementLookup>();
            this.applicationModel   = sourceModel;

            foreach (EnvironmentalOverridesElement mergeElement in environmentSection.MergeElements)
            {
                var payload   = new EnvironmentOverriddenElementPayload(environmentSection, mergeElement.LogicalParentElementPath);
                var reference = new EnvironmentOverriddenElementReference(elementLookup, environmentSection);
                reference.InitializeWithConfigurationElementPayload(payload);

                overriddenElements.Add(reference);
            }

            saveMergedConfigurationCommand = CreateCommand <SaveMergedEnvironmentConfigurationCommand>(this);
            saveEnvironmentDeltaCommand    = CreateCommand <SaveEnvironmentConfigurationDeltaCommand>(this);
        }
Example #38
0
        /// <summary>
        /// Initializes a new instance of <see cref="ApplicationViewModel"/>.
        /// </summary>
        /// <param name="uiService">The <see cref="IUIServiceWpf"/> that should be used to interact with the user.</param>
        /// <param name="sourceModel">The <see cref="ConfigurationSourceModel"/> that should be used to interact with the configuration schema.</param>
        /// <param name="lookup">The <see cref="ElementLookup"/> that should be used to look up <see cref="ElementViewModel"/> instances.</param>
        /// <param name="builder">The <see cref="IUnityContainer"/> instance that should be used to create view model instances with.</param>
        /// <param name="menuCommandService">The <see cref="MenuCommandService"/> that should be used to look up top-level <see cref="CommandModel"/> instances.</param>
        /// <param name="validationModel">The <see cref="ValidationModel"/> that should be used to add validation errors and warnings to.</param>
        public ApplicationViewModel(IUIServiceWpf uiService, ConfigurationSourceModel sourceModel, ElementLookup lookup,
                                    IUnityContainer builder, MenuCommandService menuCommandService,
                                    ValidationModel validationModel)
        {
            ValidationModel = validationModel;
            this.uiService = uiService;
            this.sourceModel = sourceModel;
            
            this.lookup = lookup;
            this.builder = builder;
            this.menuCommandService = menuCommandService;

            NewConfigurationCommand = new DelegateCommand(x => New());
            SaveConfigurationCommand = new DelegateCommand(x => Save());
            SaveAsConfigurationCommand = new DelegateCommand(x => SaveAs());
            OpenConfigurationCommand = new DelegateCommand(x => OpenConfigurationSource());
            ExitCommand = new DelegateCommand(x => Close());

            OpenEnvironmentCommand = new OpenEnvironmentConfigurationDeltaCommand(uiService, this);
            NewEnvironmentCommand = new DelegateCommand(x => NewEnvironment());
        }
Example #39
0
        /// <summary>
        /// Initializes a new instance of <see cref="ApplicationViewModel"/>.
        /// </summary>
        /// <param name="uiService">The <see cref="IUIServiceWpf"/> that should be used to interact with the user.</param>
        /// <param name="sourceModel">The <see cref="ConfigurationSourceModel"/> that should be used to interact with the configuration schema.</param>
        /// <param name="lookup">The <see cref="ElementLookup"/> that should be used to look up <see cref="ElementViewModel"/> instances.</param>
        /// <param name="builder">The <see cref="IUnityContainer"/> instance that should be used to create view model instances with.</param>
        /// <param name="menuCommandService">The <see cref="MenuCommandService"/> that should be used to look up top-level <see cref="CommandModel"/> instances.</param>
        /// <param name="validationModel">The <see cref="ValidationModel"/> that should be used to add validation errors and warnings to.</param>
        public ApplicationViewModel(IUIServiceWpf uiService, ConfigurationSourceModel sourceModel, ElementLookup lookup,
                                    IUnityContainer builder, MenuCommandService menuCommandService,
                                    ValidationModel validationModel)
        {
            ValidationModel  = validationModel;
            this.uiService   = uiService;
            this.sourceModel = sourceModel;

            this.lookup             = lookup;
            this.builder            = builder;
            this.menuCommandService = menuCommandService;

            NewConfigurationCommand    = new DelegateCommand(x => New());
            SaveConfigurationCommand   = new DelegateCommand(x => Save());
            SaveAsConfigurationCommand = new DelegateCommand(x => SaveAs());
            OpenConfigurationCommand   = new DelegateCommand(x => OpenConfigurationSource());
            ExitCommand = new DelegateCommand(x => Close());

            OpenEnvironmentCommand = new OpenEnvironmentConfigurationDeltaCommand(uiService, this);
            NewEnvironmentCommand  = new DelegateCommand(x => NewEnvironment());
        }
        /// <summary>
        /// Initializes a new instance of <see cref="ApplicationViewModel"/>.
        /// </summary>
        /// <param name="uiService">The <see cref="IUIServiceWpf"/> that should be used to interact with the user.</param>
        /// <param name="sourceModel">The <see cref="ConfigurationSourceModel"/> that should be used to interact with the configuration schema.</param>
        /// <param name="lookup">The <see cref="ElementLookup"/> that should be used to look up <see cref="ElementViewModel"/> instances.</param>
        /// <param name="builder">The <see cref="IUnityContainer"/> instance that should be used to create view model instances with.</param>
        /// <param name="menuCommandService">The <see cref="MenuCommandService"/> that should be used to look up top-level <see cref="CommandModel"/> instances.</param>
        /// <param name="validationModel">The <see cref="ValidationModel"/> that should be used to add validation errors and warnings to.</param>
        /// <param name="profile">The <see cref="Profile"/> that should be used to filter UI elements based on the platform.</param>
        public ApplicationViewModel(IUIServiceWpf uiService, ConfigurationSourceModel sourceModel, ElementLookup lookup,
                                    IUnityContainer builder, MenuCommandService menuCommandService,
                                    ValidationModel validationModel, Profile profile)
        {
            ValidationModel = validationModel;
            this.uiService = uiService;
            this.sourceModel = sourceModel;

            this.lookup = lookup;
            this.builder = builder;
            this.menuCommandService = menuCommandService;
            this.profile = profile;

            NewConfigurationCommand = new DelegateCommand(x => New());
            SaveConfigurationCommand = new DelegateCommand(x => Save());
            SaveAsConfigurationCommand = new DelegateCommand(x => SaveAs());
            OpenConfigurationCommand = new DelegateCommand(x => OpenConfigurationSource());
            ExitCommand = new DelegateCommand(x => Close());

            var environmentCommandsEnabled = this.profile == null ? true : profile.EnvironmentCommandsEnabled;
            OpenEnvironmentCommand = new OpenEnvironmentConfigurationDeltaCommand(uiService, this, environmentCommandsEnabled);
            NewEnvironmentCommand = new DelegateCommand(x => NewEnvironment(), _ => environmentCommandsEnabled);
        }
        /// <summary>
        /// Initializes a new instance of <see cref="ApplicationViewModel"/>.
        /// </summary>
        /// <param name="uiService">The <see cref="IUIServiceWpf"/> that should be used to interact with the user.</param>
        /// <param name="sourceModel">The <see cref="ConfigurationSourceModel"/> that should be used to interact with the configuration schema.</param>
        /// <param name="lookup">The <see cref="ElementLookup"/> that should be used to look up <see cref="ElementViewModel"/> instances.</param>
        /// <param name="builder">The <see cref="IUnityContainer"/> instance that should be used to create view model instances with.</param>
        /// <param name="menuCommandService">The <see cref="MenuCommandService"/> that should be used to look up top-level <see cref="CommandModel"/> instances.</param>
        /// <param name="validationModel">The <see cref="ValidationModel"/> that should be used to add validation errors and warnings to.</param>
        /// <param name="profile">The <see cref="Profile"/> that should be used to filter UI elements based on the platform.</param>
        public ApplicationViewModel(IUIServiceWpf uiService, ConfigurationSourceModel sourceModel, ElementLookup lookup,
                                    IUnityContainer builder, MenuCommandService menuCommandService,
                                    ValidationModel validationModel, Profile profile)
        {
            ValidationModel  = validationModel;
            this.uiService   = uiService;
            this.sourceModel = sourceModel;

            this.lookup             = lookup;
            this.builder            = builder;
            this.menuCommandService = menuCommandService;
            this.profile            = profile;

            NewConfigurationCommand    = new DelegateCommand(x => New());
            SaveConfigurationCommand   = new DelegateCommand(x => Save());
            SaveAsConfigurationCommand = new DelegateCommand(x => SaveAs());
            OpenConfigurationCommand   = new DelegateCommand(x => OpenConfigurationSource());
            ExitCommand = new DelegateCommand(x => Close());

            var environmentCommandsEnabled = this.profile == null ? true : profile.EnvironmentCommandsEnabled;

            OpenEnvironmentCommand = new OpenEnvironmentConfigurationDeltaCommand(uiService, this, environmentCommandsEnabled);
            NewEnvironmentCommand  = new DelegateCommand(x => NewEnvironment(), _ => environmentCommandsEnabled);
        }
 public TestCommandModel(IUIServiceWpf uiService)
     : base(uiService)
 {
 }
Example #43
0
 public AddTemplatedRegistrationMethodCommand(InjectionMemberCollectionViewModel collection, MethodInfo method, IUIServiceWpf uiService)
     : base(new ConfigurationElementType(typeof(MethodElement)), collection, uiService)
 {
     this.collection = collection;
     this.method     = method;
 }
 ///<summary>
 /// Initializes a new instance of <see cref="LogExceptionsToDatabaseCommand"/>.
 ///</summary>
 ///<param name="attribute">The <see cref="CommandAttribute"/> used to define this command.</param>
 ///<param name="uiService">The user-interface service for displaying messages or dialogs.</param>
 ///<param name="resolver">The resolver to use to create <see cref="WizardModel"/> instances.</param>
 public LogExceptionsToDatabaseCommand(WizardCommandAttribute attribute,
                                       IUIServiceWpf uiService, IResolver<WizardModel> resolver) :
                                           base(attribute, uiService, resolver)
 { }
 public ExportKeyCommand(CommandAttribute commandAttribute, ElementViewModel subject, IUIServiceWpf uiService)
     : base(commandAttribute, uiService)
 {
     this.uiService   = uiService;
     this.keyProperty = subject.Properties.OfType <ICryptographicKeyProperty>().FirstOrDefault();
 }
 public SymmetricAlgorithmProviderAddCommand(IUIServiceWpf uiService, IAssemblyDiscoveryService discoveryService, TypePickingCommandAttribute commandAttribute, ConfigurationElementType configurationElementType, ElementCollectionViewModel elementCollectionModel)
     : base(uiService, discoveryService, commandAttribute, configurationElementType, elementCollectionModel)
 {
 }
Example #47
0
 public TemplatedInjectionMemberCommandBase(ConfigurationElementType configurationElementType, ElementCollectionViewModel collection, IUIServiceWpf uiService)
     : base(configurationElementType, collection, uiService)
 {
 }
Example #48
0
 public TestableCommandModel(CommandAttribute attribute, IUIServiceWpf uiService)
     : base(attribute, uiService)
 {
 }
 public AddTemplatedRegistrationMethodCommand(InjectionMemberCollectionViewModel collection, MethodInfo method, IUIServiceWpf uiService)
     : base(new ConfigurationElementType(typeof(MethodElement)), collection, uiService)
 {
     this.collection = collection;
     this.method = method;
 }
 public AnotherCustomElementCollectionAddCommand(ConfigurationElementType configurationElementType, ElementCollectionViewModel elementCollectionModel, IUIServiceWpf uiService) :
     base(configurationElementType, elementCollectionModel, uiService)
 {
 }
        public TemplatedInjectionMemberCommandBase(ConfigurationElementType configurationElementType, ElementCollectionViewModel collection, IUIServiceWpf uiService)
            : base(configurationElementType, collection, uiService)
        {

        }
Example #52
0
 ///<summary>
 /// Initializes a new instance of <see cref="HiddenCommand"/>.
 ///</summary>
 ///<param name="attribute">The command attribute providing context for this command.</param>
 ///<param name="uiService">The user-interface service used to display messages and windows to the user.</param>
 public HiddenCommand(CommandAttribute attribute, IUIServiceWpf uiService) :
     base(attribute, uiService)
 {
     this.Browsable = false;
 }
 public AddCachingBlockCommand(ConfigurationSourceModel configurationSourceModel, AddApplicationBlockCommandAttribute attribute, IUIServiceWpf uiService)
     : base(configurationSourceModel, attribute, uiService)
 {
 }
 /// <summary>
 /// Initializes a new instance of <see cref="DefaultSectionDeleteCommandModel"/>
 /// </summary>
 /// <param name="section">The section element to apply this command to.</param>
 /// <param name="uiService">The UI service used to display messages.</param>
 public DefaultSectionDeleteCommandModel(ElementViewModel section, IUIServiceWpf uiService) 
     : base(section, uiService)
 {
     this.uiService = uiService;
 }
 public SaveEnvironmentConfigurationDeltaCommand(IUIServiceWpf uiService, ElementViewModel overridesViewModel)
     : base(uiService)
 {
     this.overridesViewModel = (EnvironmentSourceViewModel)overridesViewModel;
 }
 public ExportKeyCommand(CommandAttribute commandAttribute, ElementViewModel subject, IUIServiceWpf uiService)
     :base(commandAttribute, uiService)
 {
     this.uiService = uiService;
     this.keyProperty = subject.Properties.OfType<ICryptographicKeyProperty>().FirstOrDefault();
 }
 public AddTemplatedInjectionPropertyCommand(ElementCollectionViewModel collection, PropertyInfo property, IUIServiceWpf uiService)
     : base(new ConfigurationElementType(typeof(PropertyElement)), collection, uiService)
 {
     this.property = property;
 }
 ///<summary>
 /// Initializes a new instance of <see cref="LogExceptionsToDatabaseCommand"/>.
 ///</summary>
 ///<param name="attribute">The <see cref="CommandAttribute"/> used to define this command.</param>
 ///<param name="uiService">The user-interface service for displaying messages or dialogs.</param>
 ///<param name="resolver">The resolver to use to create <see cref="WizardModel"/> instances.</param>
 public LogExceptionsToDatabaseCommand(WizardCommandAttribute attribute,
                                       IUIServiceWpf uiService, IResolver <WizardModel> resolver) :
     base(attribute, uiService, resolver)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="WellKnownRetryStrategyElementCollectionCommand"/> class.
        /// </summary>
        /// <param name="collection">The collection that will be affected by the add command.</param>
        /// <param name="uiService">The <see cref="IUIServiceWpf"/> for displaying messages.</param>
        public WellKnownRetryStrategyElementCollectionCommand(ElementCollectionViewModel collection, IUIServiceWpf uiService)
            : base(collection, uiService)
        {
            this.section = collection.ContainingSection;

            var knownTypes = new[]
            {
                typeof(IncrementalData), typeof(FixedIntervalData), typeof(ExponentialBackoffData),
                typeof(CustomRetryStrategyData)
            };

            this.childCommands = knownTypes
                                 .SelectMany(x => this.section.CreateCollectionElementAddCommand(x, collection))
                                 .OrderBy(x => x.Title)
                                 .ToArray();
        }