|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using BPA.Helper;
- using System.Collections.Concurrent;
- using System.Collections.ObjectModel;
- using System.Windows;
- using BPA.Helper;
-
- using BPASmartClient.JXJFoodSmallStation.Model;
- using BPASmartClient.JXJFoodSmallStation.View;
- using BPASmartClient.CustomResource.UserControls;
- using BPASmartClient.CustomResource.UserControls.Model;
- using BPASmartClient.CustomResource.UserControls.Enum;
- using System.Windows.Media;
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.Model;
-
- namespace BPASmartClient.JXJFoodSmallStation.ViewModel
- {
- public class RecipeSettingsViewModel : NotifyBase
- {
- public RecipeSettingsViewModel()
- {
- RemoteRecipes = Json<LocaPar>.Data.RemoteRecipes;
-
- NewMaterital = new BPARelayCommand(() =>
- {
- NewMaterialView newMateritalView = new NewMaterialView();
- newMateritalView.ShowDialog();
- });
- NewRecipe = new BPARelayCommand(() =>
- {
- NewRecipeView nrv = new NewRecipeView();
- nrv.ShowDialog();
- MessageNotify.GetInstance.ShowUserLog("新建配方");
- });
- SaveRecipe = new BPARelayCommand(() =>
- {
- Json<LocaPar>.Save();
- MessageNotify.GetInstance.ShowUserLog("保存配方");
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!");
- });
- RemoveCommand = new BPARelayCommand<object>((o) =>
- {
- if (o is string str)
- {
- var res = Json<LocaPar>.Data.RemoteRecipes.FirstOrDefault(p => p.RecipCode == str);
- if (res != null) Json<LocaPar>.Data.RemoteRecipes.Remove(res);
- MessageNotify.GetInstance.ShowUserLog($"删除名称——{res.RecipeName}");
- }
- });
-
- DetailsCommand = new BPARelayCommand<object>((o) =>
- {
- if (o != null && o is string str)
- {
- ActionManage.GetInstance.CancelRegister("Details");
- NewRecipeView nrv = new NewRecipeView();
- var res = Json<LocaPar>.Data.RemoteRecipes.FirstOrDefault(p => p.RecipCode == str);
- ActionManage.GetInstance.Send("Details", res);
- nrv.ShowDialog();
- MessageNotify.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}");
- }
- });
-
- }
-
- public BPARelayCommand NewMaterital { get; set; }
-
- public BPARelayCommand NewRecipe { get; set; }
-
- public BPARelayCommand SaveRecipe { get; set; }
-
- public BPARelayCommand<object> EditCommand { get; set; }
-
- public BPARelayCommand<object> DetailsCommand { get; set; }
-
- public BPARelayCommand<object> RemoveCommand { get; set; }
-
- public ObservableCollection<RecipeModel> RemoteRecipes { get; set; }
- }
- }
|