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)