public void Execute(object parameter) { if (isPined) { return; } isPined = true; OnCanExecuteChanged(); var pinBuildView = new PinBuildView(); pinBuildView.DataContext = new PinBuildViewModel(pinBuildView, mainWindowViewModel, buildInformation); pinBuildView.Left = SystemParameters.FullPrimaryScreenWidth - pinBuildView.Width - 10; pinBuildView.Top = SystemParameters.FullPrimaryScreenHeight - pinBuildView.Height - 10; pinBuildView.Closing += PinBuildViewClosing; var buildDefinition = MonitorSettingsContainer.BuildServers.SelectMany(x => x.BuildDefinitions).FirstOrDefault(x => x.Id == buildInformation.BuildDefinitionId); if (buildDefinition != null) { buildDefinition.IsPined = true; Settings.Default.Save(); if (buildDefinition.PinLeft > 0 && buildDefinition.PinTop > 0) { pinBuildView.Left = buildDefinition.PinLeft; pinBuildView.Top = buildDefinition.PinTop; } } pinBuildView.Show(); mainWindowViewModel.PinBuildViews.Add(pinBuildView); }
public PinBuildViewModel(PinBuildView owner, MainWindowViewModel mainWindowViewModel, BuildInformation buildInformation) : base(mainWindowViewModel, buildInformation, true) { MainWindowViewModel = mainWindowViewModel; Maximum = ActualValue = mainWindowViewModel.Maximum; CloseCommand = new ClosePinBuildCommand(owner, buildInformation); Refresh(); mainWindowViewModel.PropertyChanged += MainWindowViewModelOnPropertyChanged; mainWindowViewModel.Refreshing += MainWindowViewModelRefreshing; }
public ClosePinBuildCommand(PinBuildView pinBuildView, BuildInformation buildInformation) { this.pinBuildView = pinBuildView; this.buildInformation = buildInformation; }