终端一体化运控平台
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

51 satır
1.7 KiB

  1. using BPASmartClient.CustomResource.Pages.Model;
  2. using BPA.Helper;
  3. using BPA.Helper;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace BPASmartClient.JXJFoodBigStation.ViewModel
  10. {
  11. internal class ChangeDeviceNameViewModel:NotifyBase
  12. {
  13. private static string IpAddress = string.Empty;
  14. public BPARelayCommand ConfirmCommand { get; set; }
  15. public BPARelayCommand CancleCommand { get; set; }
  16. public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
  17. private string _mErrorInfo;
  18. public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
  19. private string _mDeviceName;
  20. public ChangeDeviceNameViewModel()
  21. {
  22. ActionManage.GetInstance.Register(new Action<object>((o) =>
  23. {
  24. if (o != null && o is string str) IpAddress = str;
  25. }), "ChangeDeviceNameViewOpen");
  26. CancleCommand = new BPARelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); });
  27. ConfirmCommand = new BPARelayCommand(() =>
  28. {
  29. if (string.IsNullOrEmpty(DeviceName))
  30. {
  31. ErrorInfo = "设备名称不能为空";
  32. return;
  33. }
  34. ActionManage.GetInstance.Send("UpdateDeviceName", DeviceName);
  35. MessageNotify.GetInstance.ShowUserLog($"修改了设备名称为【{DeviceName}】。");
  36. ActionManage.GetInstance.Send("ChangeDeviceNameViewClose");
  37. });
  38. }
  39. }
  40. }