private void NewWatch_OnClick(object sender, RoutedEventArgs e) { _model = CreateWatchInfoNew(); UpdateViewModel(_model); WatchInfoCombo.SelectedItem = null; }
public void UpdateViewModel(CarpetWatchInfo info) { //TODO: add automapper _viewModel = new CarpetWatchInfoEditViewModel { Name = info.Name, DestBaseDir = info.DestBaseDir, IncludeSubdirectories = info.IncludeSubdirectories, }; this.DataContext = _viewModel; CodeEditor.GenerateCode(info.Dirs, info.FileDestFunc, info.DirDestFunc); }
private void WatchInfoCombo_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (WatchInfoCombo.SelectedItem == null) { Delete.Visibility = Visibility.Collapsed; return; } else { Delete.Visibility = Visibility.Visible; } _model = (((ComboBoxItem)WatchInfoCombo.SelectedItem).DataContext as CarpetWatchInfo) ?? CreateWatchInfoNew(); UpdateViewModel(_model); }
private void InitViewModel(ComboBoxItem item) { if (item == null) { _model = CreateWatchInfoNew(); UpdateViewModel(_model); WatchInfoCombo.SelectedItem = null; } else { _model = item.DataContext as CarpetWatchInfo; UpdateViewModel(_model); WatchInfoCombo.SelectedItem = item; } }
public CarpetManager(CarpetWatchInfo info) { Info = info; _shortcut = new Shortcut(); }