终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OutletManagementViewModel.cs 1.9 KiB

2 years ago
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.DosingSystemSingle.View;
  9. namespace BPASmartClient.DosingSystemSingle.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. }