Example #1
0
        public ApplicationConfigViewModel(IApplicationConfig model, IDialogCoordinator dialogCoordinator, AuthenticationViewModel authentication,
                                          AuthorizationViewModel authorization, UserInterfaceViewModel ui, RateLimitsViewModel rate, IpDetectionViewModel ip,
                                          AuditingViewModel audit, EmailViewModel mail, HostingViewModel hosting, ActiveDirectoryConfigurationViewModel ad,
                                          JitConfigurationViewModel jit, LapsConfigurationViewModel laps, HelpViewModel help)
        {
            this.model             = model;
            this.dialogCoordinator = dialogCoordinator;

            this.hosting = hosting;
            this.Items.Add(hosting);

            this.suspendedModels = new List <PropertyChangedBase>();

            RegistryKey key = Registry.LocalMachine.OpenSubKey(AccessManager.Constants.BaseKey);
            bool        currentlyUnconfigured = !(key?.GetValue("Configured", 0) is int value) || value == 0;

            if (currentlyUnconfigured)
            {
                this.suspendedModels.Add(authentication);
                this.suspendedModels.Add(ad);
                this.suspendedModels.Add(audit);
                this.suspendedModels.Add(authorization);
                this.suspendedModels.Add(jit);
                this.suspendedModels.Add(laps);
                this.suspendedModels.Add(ui);
                this.suspendedModels.Add(mail);
                this.suspendedModels.Add(rate);
                this.suspendedModels.Add(ip);
            }
            else
            {
                this.Items.Add(authentication);
                this.Items.Add(ad);
                this.Items.Add(audit);
                this.Items.Add(authorization);
                this.Items.Add(jit);
                this.Items.Add(laps);
                this.Items.Add(ui);
                this.Items.Add(mail);
                this.Items.Add(rate);
                this.Items.Add(ip);
            }

            this.OptionItems = new BindableCollection <PropertyChangedBase>();
            this.OptionItems.Add(help);

            this.ActiveItem = this.Items.First();
        }
        public MainWindowViewModel(IApplicationConfig model, AuthenticationViewModel authentication, AuthorizationViewModel authorization, UserInterfaceViewModel ui, RateLimitsViewModel rate, IpDetectionViewModel ip,
                                   AuditingViewModel audit, EmailViewModel mail, HostingViewModel hosting, ActiveDirectoryConfigurationViewModel ad,
                                   JitConfigurationViewModel jit, LapsConfigurationViewModel laps, HelpViewModel help, BitLockerViewModel bitLocker, LicensingViewModel lic, HighAvailabilityViewModel havm, IEventAggregator eventAggregator, IDialogCoordinator dialogCoordinator, ILogger <MainWindowViewModel> logger, IShellExecuteProvider shellExecuteProvider, IWindowsServiceProvider windowsServiceProvider, IRegistryProvider registryProvider, ICertificateSynchronizationProvider certSyncProvider, IAmsLicenseManager licenseManager, IClusterProvider clusterProvider)
        {
            this.model = model;
            this.shellExecuteProvider = shellExecuteProvider;
            this.logger                 = logger;
            this.dialogCoordinator      = dialogCoordinator;
            this.windowsServiceProvider = windowsServiceProvider;
            this.hosting                = hosting;
            this.registryProvider       = registryProvider;
            this.eventAggregator        = eventAggregator;
            this.certSyncProvider       = certSyncProvider;
            this.dialogCoordinator      = dialogCoordinator;
            this.licenseManager         = licenseManager;
            this.clusterProvider        = clusterProvider;
            this.clusterWaitSemaphore   = new SemaphoreSlim(0, 1);

            this.eventAggregator.Subscribe(this);
            this.DisplayName = Constants.AppName;

            this.Items.Add(hosting);
            this.Items.Add(authentication);
            this.Items.Add(ui);
            this.Items.Add(mail);
            this.Items.Add(rate);
            this.Items.Add(ip);
            this.Items.Add(ad);
            this.Items.Add(audit);
            this.Items.Add(laps);
            this.Items.Add(jit);
            this.Items.Add(bitLocker);
            this.Items.Add(authorization);
            this.Items.Add(lic);
            this.Items.Add(havm);

            this.OptionItems = new BindableCollection <PropertyChangedBase> {
                help
            };

            this.ActiveItem = this.Items.First();

            this.UpdateIsConfigured();
            this.SetupClusterMonitor();
        }