|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.MorkCL.Model.Json;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.MorkCL.ViewModel
- {
- public class ParSetViewModel:NotifyBase
- {
- public ParSetViewModel()
- {
- Param = Json<ConnectPar>.Data;
- SaveInfoCommand = new(() =>
- {
- if (MessageNotify.GetInstance.ShowDialog("确认保存配置文件?"))
- {
- if (Param.IsUseSplitStorage)
- {
- if (!VerifyData())
- {
- MessageNotify.GetInstance.ShowNotify("失败", "参数不合规,保存失败。", EnumPromptType.Error);
- return;
- }
- }
- Json<ConnectPar>.Save();
- MessageNotify.GetInstance.ShowNotify("成功", "保存参数设置成功。");
-
- }
- });
- }
-
- private ConnectPar _param;
- /// <summary>
- /// 配置参数。
- /// </summary>
- public ConnectPar Param
- {
- get { return _param; }
- set { _param = value; OnPropertyChanged(); }
- }
-
- /// <summary>
- /// 保存配置信息
- /// </summary>
- public BPARelayCommand SaveInfoCommand { get; set; }
-
- private bool VerifyData()
- {
- 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))
- {
- return true;
- }
- else
- {
- MessageNotify.GetInstance.ShowDialog("辅料库位的位置号码应大于等于 1 且 小于等于8 ,请检查后重试。",DialogType.Error);
- return false;
- }
- }
-
- private bool CheckNumRange(int number,int min,int max)
- {
- if (number >= min && number <= max)
- {
- return true;
- }
- else
- return false;
- }
-
- }
- }
|