using BPA.Helper; using BPASmartClient.CustomResource.UserControls; using BPASmartClient.CustomResource.UserControls.MessageShow; using System.Text; namespace BPASmartClient.DosingSystem.ViewModel { public class CommparSetViewModel : NotifyBase { public CommparSetViewModel() { SaveCommand = new BPARelayCommand(() => { if (!string.IsNullOrEmpty(CommBaseParModel.NetworkSegAddress)) { var res = CommBaseParModel.NetworkSegAddress.Split("."); if (res != null) { if (res.Length >= 3) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 3; i++) sb.Append($"{res[i]}."); Json.Data.BaseParModel.NetworkSegAddress = sb.ToString(); Json.Save(); NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"参数保存成功!"); } } } }); } public BasePar CommBaseParModel { get { return Json.Data.BaseParModel; } set { Json.Data.BaseParModel = value; OnPropertyChanged(); } } //private BasePar _mCommBaseParModel; public BPARelayCommand SaveCommand { get; set; } } }