修改ping成型机ip的时间

master
zhaoaomin 2 years ago
parent fcb9959490
commit c0b6273a50

@ -34,7 +34,7 @@ namespace XGL.FormItem
Timer timer = new Timer(); Timer timer = new Timer();
string deviceCode = Utils.GetAppSetting("DeviceCode"); string deviceCode = Utils.GetAppSetting("DeviceCode");
Timer timerDeciveState = new Timer(); Timer timerDeciveState = new Timer();
System.Threading.Timer Time { get; set; } 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.Interval = Utils.GetAppSetting("GetDeviceStateInterval") == "" ? 15000 : Convert.ToInt32(Utils.GetAppSetting("GetDeviceStateInterval"));
timerDeciveState.Elapsed += TimerDeciveState_Elapsed; timerDeciveState.Elapsed += TimerDeciveState_Elapsed;
timerDeciveState.Start(); timerDeciveState.Start();
this.lbVersion.Content = LoginUser.Version; 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); }, 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) static void PingTest(string ip)
{ {
@ -323,6 +309,7 @@ namespace XGL.FormItem
new Action(() => { LbDeviceState.Text = dt.Rows[0][0].ToString() == "1" ? "正常" : "异常"; } new Action(() => { LbDeviceState.Text = dt.Rows[0][0].ToString() == "1" ? "正常" : "异常"; }
), ),
System.Windows.Threading.DispatcherPriority.Render); System.Windows.Threading.DispatcherPriority.Render);
PingTest(dt.Rows[0][1].ToString());
if (dt.Rows[0][0].ToString() == "1" ) if (dt.Rows[0][0].ToString() == "1" )
{ {
//if (time == 6) //if (time == 6)

Loading…
Cancel
Save