终端一体化运控平台
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.
 
 
 

44 lines
1.6 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.CustomResource.UserControls;
  9. using BPASmartClient.CustomResource.UserControls.MessageShow;
  10. namespace BPASmartClient.DosingSystem.ViewModel
  11. {
  12. public class CommparSetViewModel : NotifyBase
  13. {
  14. public CommparSetViewModel()
  15. {
  16. SaveCommand = new BPARelayCommand(() =>
  17. {
  18. if (!string.IsNullOrEmpty(CommBaseParModel.NetworkSegAddress))
  19. {
  20. var res = CommBaseParModel.NetworkSegAddress.Split(".");
  21. if (res != null)
  22. {
  23. if (res.Length >= 3)
  24. {
  25. StringBuilder sb = new StringBuilder();
  26. for (int i = 0; i < 3; i++) sb.Append($"{res[i]}.");
  27. Json<DevicePar>.Data.BaseParModel.NetworkSegAddress = sb.ToString();
  28. Json<DevicePar>.Save();
  29. NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"参数保存成功!");
  30. }
  31. }
  32. }
  33. });
  34. }
  35. public BasePar CommBaseParModel { get { return Json<DevicePar>.Data.BaseParModel; } set { Json<DevicePar>.Data.BaseParModel = value; OnPropertyChanged(); } }
  36. //private BasePar _mCommBaseParModel;
  37. public BPARelayCommand SaveCommand { get; set; }
  38. }
  39. }