终端一体化运控平台
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

57 righe
1.9 KiB

  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. }