Files

85 lines
2.2 KiB
C#

using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Net.NetworkInformation;
using System.Threading;
using System.Windows.Forms;
namespace AGVSystem
{
// Token: 0x02000008 RID: 8
public partial class APTest : Form
{
// Token: 0x0600007C RID: 124 RVA: 0x0000FF84 File Offset: 0x0000E184
public APTest()
{
this.InitializeComponent();
this.ds = this.db.connDt("select id as 编号, ipaddress as ip地址 , ssid ,'' as 网络状态 from AP_Site");
bool flag = this.ds.Tables.Count > 0;
if (flag)
{
this.dataGridView1.DataSource = this.ds.Tables[0];
}
}
// Token: 0x0600007D RID: 125 RVA: 0x00010014 File Offset: 0x0000E214
private void button1_Click(object sender, EventArgs e)
{
this.button1.Enabled = false;
Thread thread = new Thread(new ThreadStart(this.pingnet));
thread.Start();
}
// Token: 0x0600007E RID: 126 RVA: 0x00010048 File Offset: 0x0000E248
private void pingnet()
{
bool invokeRequired = base.InvokeRequired;
if (invokeRequired)
{
base.Invoke(new APTest.PingNet(this.pingnet));
}
else
{
bool flag = this.dataGridView1.RowCount > 0;
if (flag)
{
for (int i = 0; i < this.dataGridView1.RowCount; i++)
{
try
{
bool flag2 = this.ping.Send(this.dataGridView1.Rows[i].Cells["ip地址"].Value.ToString(), 1000).Status == IPStatus.Success;
if (flag2)
{
this.dataGridView1.Rows[i].Cells["网络状态"].Value = "[" + DateTime.Now.ToLongTimeString() + "]:ok";
}
else
{
this.dataGridView1.Rows[i].Cells["网络状态"].Value = "[" + DateTime.Now.ToLongTimeString() + "]:网络异常";
}
}
catch
{
this.dataGridView1.Rows[i].Cells["网络状态"].Value = "[" + DateTime.Now.ToLongTimeString() + "]:网络异常";
}
}
this.button1.Enabled = true;
}
}
}
// Token: 0x040000F6 RID: 246
private ClsDBConn_sql db = new ClsDBConn_sql();
// Token: 0x040000F7 RID: 247
private DataSet ds = new DataSet();
// Token: 0x040000F8 RID: 248
private Ping ping = new Ping();
// Token: 0x0200003A RID: 58
// (Invoke) Token: 0x060002D5 RID: 725
private delegate void PingNet();
}
}