终端一体化运控平台
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

49 rader
1.6 KiB

  1. using BPASmartClient.Helper;
  2. using Microsoft.Toolkit.Mvvm.ComponentModel;
  3. using Microsoft.Toolkit.Mvvm.Input;
  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:ObservableObject
  12. {
  13. private static string IpAddress = string.Empty;
  14. public RelayCommand ConfirmCommand { get; set; }
  15. public RelayCommand 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 RelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); });
  27. ConfirmCommand = new RelayCommand(() =>
  28. {
  29. if (string.IsNullOrEmpty(DeviceName))
  30. {
  31. ErrorInfo = "设备名称不能为空";
  32. return;
  33. }
  34. ActionManage.GetInstance.Send("UpdateDeviceName", DeviceName);
  35. ActionManage.GetInstance.Send("ChangeDeviceNameViewClose");
  36. });
  37. }
  38. }
  39. }