From eb6cf78500192439d51a2b1516bb84e8b4fba6fb Mon Sep 17 00:00:00 2001 From: MoYue Date: Thu, 29 Aug 2024 13:44:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E7=A9=BA=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/Dialogs/ModifySequentialViewModel.cs | 3 ++- .../Pages/Dialogs/ModifySysDevicesViewModel.cs | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/InSituLaboratory/ViewModels/Pages/Dialogs/ModifySequentialViewModel.cs b/InSituLaboratory/ViewModels/Pages/Dialogs/ModifySequentialViewModel.cs index 7cded21..f3e45e3 100644 --- a/InSituLaboratory/ViewModels/Pages/Dialogs/ModifySequentialViewModel.cs +++ b/InSituLaboratory/ViewModels/Pages/Dialogs/ModifySequentialViewModel.cs @@ -29,7 +29,7 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs public SysSequentialDetails SysSequentialdata { get; set; } - public List Intlist { get; set; } = new List() { 1, 2, 3, 4, 5, 6 }; + public static List Intlist { get; set; } = new List() { 1, 2, 3, 4, 5, 6 }; public string? workTime { get; set; } public string? minworkTime { get; set; } @@ -163,6 +163,7 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs } DeviceNodes = _deviceSvice.GetDevices().ToList(); + Intlist = new List() { 1, 2, 3, 4, 5, 6 }; } public override void DoSave() diff --git a/InSituLaboratory/ViewModels/Pages/Dialogs/ModifySysDevicesViewModel.cs b/InSituLaboratory/ViewModels/Pages/Dialogs/ModifySysDevicesViewModel.cs index 05ee323..2b497d4 100644 --- a/InSituLaboratory/ViewModels/Pages/Dialogs/ModifySysDevicesViewModel.cs +++ b/InSituLaboratory/ViewModels/Pages/Dialogs/ModifySysDevicesViewModel.cs @@ -2,6 +2,7 @@ using InSituLaboratory.IService; using InSituLaboratory.Models; using InSituLaboratory.Service; +using Microsoft.IdentityModel.Tokens; using Prism.Commands; using Prism.Services.Dialogs; using System; @@ -10,6 +11,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; +using System.Windows.Forms; namespace InSituLaboratory.ViewModels.Pages.Dialogs { @@ -59,6 +61,12 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs { try { + //非空校验 + if (string.IsNullOrEmpty(SysDevice.DeviceType) || string.IsNullOrEmpty(SysDevice.DeviceName) || string.IsNullOrEmpty(SysDevice.WorkTime) || string.IsNullOrEmpty(SysDevice.MinWorkTime)) + { + throw new Exception("参数配置信息不能为空!"); + } + //新增 if (SysDevice.ID == 0) { @@ -84,7 +92,7 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs } catch (Exception ex) { - MessageBox.Show(ex.Message); + System.Windows.Forms.MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }