public MultiEnvironmentWorkflowDefinitionViewModel(MultiEnvironmentWorkflowDefinition item, ITFSConnectivity tfsConnectivity, ITFSBuild tfsBuild, ITFSLabEnvironment tfsLabEnvironment, ITFSTest tfsTest, IRegionManager regionManager, IEventAggregator eventAggregator) { this.Item = item; this.tfsConnectivity = tfsConnectivity; this.tfsBuild = tfsBuild; this.tfsLabEnvironment = tfsLabEnvironment; this.tfsTest = tfsTest; this.regionManager = regionManager; this.eventAggregator = eventAggregator; this.buildScheduleViewModel = new BuildScheduleViewModel(this.Item); this.AvailableTestSuites = new SelectableCollection<AssociatedTestSuite>(); this.AvailableEnvironments = new SelectableCollection<AvailableEnvironmentViewModel>(); this.GenerateBuildDefinitionsCommand = new DelegateCommand(GenerateBuildDefinitions, () => !HasErrors && !this.IsGeneratingBuildDefinitions); this.DeleteBuildDefinitionsCommand = new DelegateCommand(DeleteExistingBuildDefinitions, () => !this.IsGeneratingBuildDefinitions); this.AddDeploymentScriptCommand = new DelegateCommand(AddDeploymentScript); this.RemoveDeploymentScriptCommand = new DelegateCommand<DeploymentScript>(RemoveDeploymentScript); this.RefreshDataCommand = new DelegateCommand(InitializeData); CompositeApplicationCommands.RefreshCommand.RegisterCommand(this.RefreshDataCommand); this.Item.PropertyChanged += (sender, args) => { if (args.PropertyName.Equals("Name") || args.PropertyName.Equals("IsDirty")) this.RaisePropertyChanged(() => this.HeaderInfo); }; this.Item.MainLabWorkflowDefinition.SourceBuildDetails.PropertyChanged += (sender, args) => { if (args.PropertyName.Equals("QueueNewBuild")) { if (this.Item.MainLabWorkflowDefinition.SourceBuildDetails.QueueNewBuild) { this.Item.MainLabWorkflowDefinition.SourceBuildDetails.BuildUri = null; this.RaisePropertyChanged(() => this.SelectedBuildtoUse); } } }; InitializeData(); }
private void DeleteDefinition(MultiEnvironmentWorkflowDefinition item) { this.workflowManagerStorage.Definitions.Remove(item); this.RaisePropertyChanged(() => this.Definitions); }
private void EditDefinition(MultiEnvironmentWorkflowDefinition item) { var existingViewModel = this.regionManager.Regions[RegionNames.MainRegion].Views.Where(v => { var mewdvm = v as MultiEnvironmentWorkflowDefinitionViewModel; if (mewdvm != null) { return mewdvm.Item.Equals(item); } return false; }).FirstOrDefault(); if (existingViewModel != null) { this.regionManager.Regions[RegionNames.MainRegion].Activate(existingViewModel); } else { var vm = new MultiEnvironmentWorkflowDefinitionViewModel(item, this.tfsConnectivity, this.tfsBuild, this.tfsLabEnvironment, this.tfsTest, this.regionManager, this.eventAggregator); vm.CloseViewCommand = new DelegateCommand(() => { this.regionManager.Regions[RegionNames.MainRegion].Remove(vm); }); this.regionManager.AddToRegion(RegionNames.MainRegion, vm); } }
private void AddNewDefinition() { var newDefinition = new MultiEnvironmentWorkflowDefinition() { Name = ModuleStrings.NewDefinitionname }; this.workflowManagerStorage.Definitions.Add(newDefinition); this.CurrentDefinition = newDefinition; }