终端一体化运控平台
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

51 lignes
1.7 KiB

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