终端一体化运控平台
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

75 rindas
2.3 KiB

  1. using BPASmartClient.CustomResource.Pages.Model;
  2. using BPASmartClient.MorkCL.Model.Json;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace BPASmartClient.MorkCL.ViewModel
  9. {
  10. public class ParSetViewModel:NotifyBase
  11. {
  12. public ParSetViewModel()
  13. {
  14. Param = Json<ConnectPar>.Data;
  15. SaveInfoCommand = new(() =>
  16. {
  17. if (MessageNotify.GetInstance.ShowDialog("确认保存配置文件?"))
  18. {
  19. if (Param.IsUseSplitStorage)
  20. {
  21. if (!VerifyData())
  22. {
  23. MessageNotify.GetInstance.ShowNotify("失败", "参数不合规,保存失败。", EnumPromptType.Error);
  24. return;
  25. }
  26. }
  27. Json<ConnectPar>.Save();
  28. MessageNotify.GetInstance.ShowNotify("成功", "保存参数设置成功。");
  29. }
  30. });
  31. }
  32. private ConnectPar _param;
  33. /// <summary>
  34. /// 配置参数。
  35. /// </summary>
  36. public ConnectPar Param
  37. {
  38. get { return _param; }
  39. set { _param = value; OnPropertyChanged(); }
  40. }
  41. /// <summary>
  42. /// 保存配置信息
  43. /// </summary>
  44. public BPARelayCommand SaveInfoCommand { get; set; }
  45. private bool VerifyData()
  46. {
  47. if (CheckNumRange(Param.FryPanAccessoriesMin_1,1,8)&& CheckNumRange(Param.FryPanAccessoriesMax_1, 1, 8)&& CheckNumRange(Param.FryPanAccessoriesMin_2, 1, 8)&& CheckNumRange(Param.FryPanAccessoriesMax_2, 1, 8))
  48. {
  49. return true;
  50. }
  51. else
  52. {
  53. MessageNotify.GetInstance.ShowDialog("辅料库位的位置号码应大于等于 1 且 小于等于8 ,请检查后重试。",DialogType.Error);
  54. return false;
  55. }
  56. }
  57. private bool CheckNumRange(int number,int min,int max)
  58. {
  59. if (number >= min && number <= max)
  60. {
  61. return true;
  62. }
  63. else
  64. return false;
  65. }
  66. }
  67. }