终端一体化运控平台
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

87 rindas
3.1 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using BPA.Helper;
  7. using System.Collections.Concurrent;
  8. using System.Collections.ObjectModel;
  9. using System.Windows;
  10. using BPA.Helper;
  11. using BPASmartClient.JXJFoodSmallStation.Model;
  12. using BPASmartClient.JXJFoodSmallStation.View;
  13. using BPASmartClient.CustomResource.UserControls;
  14. using BPASmartClient.CustomResource.UserControls.Model;
  15. using BPASmartClient.CustomResource.UserControls.Enum;
  16. using System.Windows.Media;
  17. using BPASmartClient.CustomResource.UserControls.MessageShow;
  18. using BPASmartClient.CustomResource.Pages.Model;
  19. using BPASmartClient.Model;
  20. namespace BPASmartClient.JXJFoodSmallStation.ViewModel
  21. {
  22. public class RecipeSettingsViewModel : NotifyBase
  23. {
  24. public RecipeSettingsViewModel()
  25. {
  26. RemoteRecipes = Json<LocaPar>.Data.RemoteRecipes;
  27. NewMaterital = new BPARelayCommand(() =>
  28. {
  29. NewMaterialView newMateritalView = new NewMaterialView();
  30. newMateritalView.ShowDialog();
  31. });
  32. NewRecipe = new BPARelayCommand(() =>
  33. {
  34. NewRecipeView nrv = new NewRecipeView();
  35. nrv.ShowDialog();
  36. MessageNotify.GetInstance.ShowUserLog("新建配方");
  37. });
  38. SaveRecipe = new BPARelayCommand(() =>
  39. {
  40. Json<LocaPar>.Save();
  41. MessageNotify.GetInstance.ShowUserLog("保存配方");
  42. NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!");
  43. });
  44. RemoveCommand = new BPARelayCommand<object>((o) =>
  45. {
  46. if (o is string str)
  47. {
  48. var res = Json<LocaPar>.Data.RemoteRecipes.FirstOrDefault(p => p.RecipCode == str);
  49. if (res != null) Json<LocaPar>.Data.RemoteRecipes.Remove(res);
  50. MessageNotify.GetInstance.ShowUserLog($"删除名称——{res.RecipeName}");
  51. }
  52. });
  53. DetailsCommand = new BPARelayCommand<object>((o) =>
  54. {
  55. if (o != null && o is string str)
  56. {
  57. ActionManage.GetInstance.CancelRegister("Details");
  58. NewRecipeView nrv = new NewRecipeView();
  59. var res = Json<LocaPar>.Data.RemoteRecipes.FirstOrDefault(p => p.RecipCode == str);
  60. ActionManage.GetInstance.Send("Details", res);
  61. nrv.ShowDialog();
  62. MessageNotify.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}");
  63. }
  64. });
  65. }
  66. public BPARelayCommand NewMaterital { get; set; }
  67. public BPARelayCommand NewRecipe { get; set; }
  68. public BPARelayCommand SaveRecipe { get; set; }
  69. public BPARelayCommand<object> EditCommand { get; set; }
  70. public BPARelayCommand<object> DetailsCommand { get; set; }
  71. public BPARelayCommand<object> RemoveCommand { get; set; }
  72. public ObservableCollection<RecipeModel> RemoteRecipes { get; set; }
  73. }
  74. }