public GoodsViewModel() { inputCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { var w = new InputWindow(); w.ShowDialog(); }); outputCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { OutputWindow w = new OutputWindow(); w.ShowDialog(); }); productCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { ProductWindow w = new ProductWindow(); w.ShowDialog(); }); categoryCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CategoryWindow w = new CategoryWindow(); w.ShowDialog(); }); statisticCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { StatisticWindow w = new StatisticWindow(); w.ShowDialog(); }); }
/// <summary> /// カテゴリ編集クリック時の処理 /// </summary> private void EditCategoryClick() { var window = new CategoryWindow() { Owner = this._window }; if (true != window.ShowDialog()) { return; } }
private void AddCategoryCommandExecute(object obj) { CategoryWindow window = container.Resolve <CategoryWindow>(new ResolverOverride[] { new ParameterOverride("actionCode", 1) }); window.Owner = (obj as Window); bool result = (bool)window.ShowDialog(); if (result) { var category = (window.DataContext as CategoryWindowViewModel).DataFormCategory; DataFormCategories.Add(category); } }
private void RemoveCategoryCommandExecute(object obj) { CategoryWindow window = container.Resolve <CategoryWindow>(new ResolverOverride[] { new ParameterOverride("actionCode", 3) }); window.Owner = (obj as Window); bool result = (bool)window.ShowDialog(); if (result) { var removedCategory = (window.DataContext as CategoryWindowViewModel).DataFormCategory; var current = DataFormCategories.Where(s => s.CategoryId == removedCategory.CategoryId).FirstOrDefault(); if (current != null) { DataFormCategories.Remove(current); } } }
private void UpdateCategoryCommandExecute(object obj) { CategoryWindow window = container.Resolve <CategoryWindow>(new ResolverOverride[] { new ParameterOverride("actionCode", 2) }); window.Owner = (obj as Window); bool result = (bool)window.ShowDialog(); if (result) { var update = (window.DataContext as CategoryWindowViewModel).DataFormCategory; var current = DataFormCategories.Where(s => s.CategoryId == update.CategoryId).FirstOrDefault(); if (current != null) { current.CategoryName = update.CategoryName; current.Description = update.Description; } } }
public void ShowSettings() { var panels = new List <CategoryPanel> { new GeneralOptionsPanel(), new AboutOptionsPanel() }; if (_optionsWindow == null) { _optionsWindow = new CategoryWindow(null, panels, Resources.ResourceManager, "OptionsWindow"); _optionsWindow.Closed += (o, args) => { _optionsWindow = null; }; } var dialogResult = _optionsWindow.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value) { Settings.Default.Save(); Refresh(); } }