From c0b6273a50a9ba28a3bda868c5ff2cbb29b6ae5e Mon Sep 17 00:00:00 2001 From: zhaoaomin <18366680202@163.com> Date: Tue, 2 Jan 2024 10:34:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9ping=E6=88=90=E5=9E=8B?= =?UTF-8?q?=E6=9C=BAip=E7=9A=84=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shangjian/XGL/FormItem/Main.xaml.cs | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/shangjian/XGL/FormItem/Main.xaml.cs b/shangjian/XGL/FormItem/Main.xaml.cs index a2a8f99..026bbc8 100644 --- a/shangjian/XGL/FormItem/Main.xaml.cs +++ b/shangjian/XGL/FormItem/Main.xaml.cs @@ -34,7 +34,7 @@ namespace XGL.FormItem Timer timer = new Timer(); string deviceCode = Utils.GetAppSetting("DeviceCode"); - Timer timerDeciveState = new Timer(); + Timer timerDeciveState = new Timer(); System.Threading.Timer Time { get; set; } @@ -176,10 +176,10 @@ namespace XGL.FormItem timerDeciveState.Interval = Utils.GetAppSetting("GetDeviceStateInterval") == "" ? 15000 : Convert.ToInt32(Utils.GetAppSetting("GetDeviceStateInterval")); timerDeciveState.Elapsed += TimerDeciveState_Elapsed; timerDeciveState.Start(); + + this.lbVersion.Content = LoginUser.Version; - FormingMachineService formingMachineService = new FormingMachineService(); - DataTable dtDeviceIP = formingMachineService.GetFormingMachineState(deviceCode); - GetDevicePingResult(dtDeviceIP.Rows[0][1].ToString()); + } @@ -246,21 +246,7 @@ namespace XGL.FormItem }, 1, 0, 2000); } - public void GetDevicePingResult(string serviceIp) - { - Time = new System.Threading.Timer((s) => - { - try - { - PingTest(serviceIp); - } - catch (Exception) - { - - } - }, 1, 0, 2000); - } - + static void PingTest(string ip) { @@ -323,6 +309,7 @@ namespace XGL.FormItem new Action(() => { LbDeviceState.Text = dt.Rows[0][0].ToString() == "1" ? "正常" : "异常"; } ), System.Windows.Threading.DispatcherPriority.Render); + PingTest(dt.Rows[0][1].ToString()); if (dt.Rows[0][0].ToString() == "1" ) { //if (time == 6)