public ZipNShareConfigDialog(ZipNShareTools toolsPage) : this() { this.toolsPage = toolsPage; ZipNShareConfigViewModel model = (ZipNShareConfigViewModel)this.DataContext; model.PropertyChanged += model_PropertyChanged; model.Initialize(toolsPage); }
private void RemoveButtonClick(object sender, RoutedEventArgs e) { ZipNShareConfigViewModel model = (ZipNShareConfigViewModel)this.DataContext; if (ExclusionsListBox.SelectedItem != null) { model.ZipExclusions.Remove((ZipExclusion)ExclusionsListBox.SelectedItem); toolsPage.Exceptions = new List <ZipExclusion>(model.ZipExclusions); } }
private void SelectOutputFolderButtonClick(object sender, RoutedEventArgs e) { System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog(); dlg.ShowNewFolderButton = true; System.Windows.Forms.DialogResult result = dlg.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { ZipNShareConfigViewModel model = (ZipNShareConfigViewModel)this.DataContext; model.OutputFolder = dlg.SelectedPath; } }
private void AddButtonClick(object sender, RoutedEventArgs e) { ZipNShareConfigViewModel model = (ZipNShareConfigViewModel)this.DataContext; if (ExclusionTypeComboBox.SelectedIndex < 0 || ExclusionExpressionTextBox.Text == string.Empty) { MessageBox.Show(@"Please Select and ExclusionType and provide and ExclusionExpression (e.g. ExclusionType=File, ExclusionExpression=.suo)", "Invalid Input", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { model.ZipExclusions.Add(new ZipExclusion { ExclusionType = (ExclusionType)ExclusionTypeComboBox.SelectedIndex, Expression = ExclusionExpressionTextBox.Text }); toolsPage.Exceptions = new List <ZipExclusion>(model.ZipExclusions); } }
void model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { ZipNShareConfigViewModel model = (ZipNShareConfigViewModel)this.DataContext; if (e.PropertyName == "OutputFileName") { toolsPage.OutputFileName = model.OutputFileName; } else if (e.PropertyName == "OutputFolder") { toolsPage.OutputFolder = model.OutputFolder; } else if (e.PropertyName == "OverwriteZipFileIfExists") { toolsPage.OverwriteZipFileIfExists = model.OverwriteZipFileIfExists; } else if (e.PropertyName == "ZipExclusions") { toolsPage.Exceptions = new List <ZipExclusion>(model.ZipExclusions); } }