终端一体化运控平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

OutletManagementViewModel.cs 1.9 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using BPA.Helper;
  8. using BPASmartClient.DosingSystem.View;
  9. namespace BPASmartClient.DosingSystem.ViewModel
  10. {
  11. public class OutletManagementViewModel : ViewModelBase
  12. {
  13. public OutletManagementViewModel()
  14. {
  15. AddCommand = new BPARelayCommand(() =>
  16. {
  17. NewOutletView newOutletView = new NewOutletView();
  18. newOutletView.ShowDialog();
  19. });
  20. SaveCommand = new BPARelayCommand(() => { Json<DevicePar>.Save(); });
  21. OutletInfoModels = Json<DevicePar>.Data.OutletInfoModels;
  22. RemoveCommand = new BPARelayCommand<object>((o) =>
  23. {
  24. if (!string.IsNullOrEmpty(o?.ToString()))
  25. {
  26. var res = Json<DevicePar>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
  27. if (res != null)
  28. {
  29. Json<DevicePar>.Data.OutletInfoModels.Remove(res);
  30. //Control.GetInstance.OperationLog($"{res.OutletName} 删除成功");
  31. }
  32. }
  33. });
  34. DetailsCommand = new BPARelayCommand<object>((o) =>
  35. {
  36. if (!string.IsNullOrEmpty(o?.ToString()))
  37. {
  38. var res = Json<DevicePar>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
  39. if (res != null)
  40. {
  41. NewOutletView newOutletView = new NewOutletView();
  42. ActionManage.GetInstance.Send("OpenNewOutlet", res);
  43. newOutletView.ShowDialog();
  44. }
  45. }
  46. });
  47. }
  48. public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; }
  49. }
  50. }