public SecurityDescriptorTargetViewModel(SecurityDescriptorTarget model, SecurityDescriptorTargetViewModelDisplaySettings displaySettings, INotificationChannelSelectionViewModelFactory notificationChannelFactory, IFileSelectionViewModelFactory fileSelectionViewModelFactory, IAppPathProvider appPathProvider, ILogger <SecurityDescriptorTargetViewModel> logger, IDialogCoordinator dialogCoordinator, IModelValidator <SecurityDescriptorTargetViewModel> validator, IDirectory directory, IDomainTrustProvider domainTrustProvider, IDiscoveryServices discoveryServices, ILocalSam localSam, IObjectSelectionProvider objectSelectionProvider, ScriptTemplateProvider scriptTemplateProvider, IAmsLicenseManager licenseManager, IShellExecuteProvider shellExecuteProvider)
        {
            this.directory                  = directory;
            this.Model                      = model;
            this.logger                     = logger;
            this.dialogCoordinator          = dialogCoordinator;
            this.notificationChannelFactory = notificationChannelFactory;
            this.Validator                  = validator;
            this.domainTrustProvider        = domainTrustProvider;
            this.discoveryServices          = discoveryServices;
            this.localSam                   = localSam;
            this.displaySettings            = displaySettings ?? new SecurityDescriptorTargetViewModelDisplaySettings();
            this.objectSelectionProvider    = objectSelectionProvider;
            this.scriptTemplateProvider     = scriptTemplateProvider;
            this.licenseManager             = licenseManager;
            this.shellExecuteProvider       = shellExecuteProvider;

            this.Script = fileSelectionViewModelFactory.CreateViewModel(model, () => model.Script, appPathProvider.ScriptsPath);
            this.Script.DefaultFileExtension = "ps1";
            this.Script.Filter           = "PowerShell script|*.ps1";
            this.Script.NewFileContent   = this.scriptTemplateProvider.GetAuthorizationResponse;
            this.Script.ShouldValidate   = false;
            this.Script.PropertyChanged += Script_PropertyChanged;
            this.Initialization          = this.Initialize();
        }
예제 #2
0
        public async Task <SecurityDescriptorTargetViewModel> CreateViewModelAsync(SecurityDescriptorTarget model, SecurityDescriptorTargetViewModelDisplaySettings settings)
        {
            var item = new SecurityDescriptorTargetViewModel(model, settings, channelSelectionViewModelFactory, fileSelectionViewModelFactory, appPathProvider, logger, dialogCoordinator, validator.Invoke(), directory, domainTrustProvider, discoveryServices, localSam, objectSelectionProvider, scriptTemplateProvider, licenseManager, shellExecuteProvider);

            await item.Initialization;

            return(item);
        }