using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace Mywifi
{
public partial class Mywifi : Form
{
public Mywifi()
{
InitializeComponent();
}
System.Diagnostics.Stopwatch sw;
///
///
///
///
private void button1_Click(object sender, EventArgs e)
{
//时间记录
sw = new System.Diagnostics.Stopwatch();
sw.Start();
timer1.Start();
//多线程执行
Thread onc = new Thread(new ThreadStart(NonpametetrRun));
onc.Start();
}
///
///
///
///
private void timer1_Tick(object sender, EventArgs e)
{
TimeSpan ts = sw.Elapsed;
shijian.Text = String.Format("{0}天{1}小时{2}分{3}秒{4}毫秒", ts.Days, ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
}
///
///
public void NonpametetrRun()
{
DataTable dt = new DataTable("date");
DataTable ds = new DataTable("date");
DataTable BS = new DataTable("date");
BS.Columns.Add("ROUTER_CMAC", Type.GetType("System.String"));
BS.Columns.Add("DEVICE_MAC", Type.GetType("System.String"));
BS.Columns.Add("CREATE_TIME", Type.GetType("System.String"));
//BS.Columns.Add("XIAXIAN_TIME", Type.GetType("System.String"));
BS.Columns.Add("ID", Type.GetType("System.String"));
BS.Columns.Add("AP_MAC", Type.GetType("System.String"));
BS.Columns.Add("SINGAL", Type.GetType("System.String"));
try
{
//分组查询
string sql = "SELECT ROUTER_MAC,DEVICE_MAC FROM macs_20140707 GROUP BY ROUTER_MAC,DEVICE_MAC";
dt = DbHelperMySqL.GetDataTable(sql);
for (int i = 0; i
{
//时间间隔之差
DateTime lastTime = DateTime.Parse(ds.Rows[c - 1][0].ToString());
DateTime currentTime = DateTime.Parse(ds.Rows[c][0].ToString());
TimeSpan span = currentTime - lastTime;
//判断时间间隔为10分种
if (span.Minutes >= 10)
{
BS.Rows.Add(new object[] { dt.Rows[i][0], dt.Rows[i][1], ds.Rows[c][0], ds.Rows[c][1], ds.Rows[c][2], ds.Rows[c][3] });
}
}
else if (c - 1
/// 委托获取最大数字
///
///
public delegate void sett(int resp);
private void setcatre(int resp)
{
if (label2.InvokeRequired == true)
{
sett set = new sett(setcatre);
label2.Invoke(set, new object[] { resp });
}
else
{
label2.Text = resp.ToString();
}
}
///
///
///
public delegate void sett1(int respd);
private void setcatred(int respd)
{
if ( shulang.InvokeRequired==true)
{
sett1 set = new sett1(setcatred);
shulang.Invoke(set, new object[] { respd });
}
else
{
shulang.Text = respd.ToString();
}
}
///
///
///
public delegate void sett2(int respd);
private void maxtat(int respd)
{
if (label5.InvokeRequired == true)
{
sett2 set = new sett2(maxtat);
label5.Invoke(set, new object[] { respd });
}
else
{
label5.Text = respd.ToString();
}
}
///
///
///
public delegate void sett3(int respd);
private void max(int respd)
{
if (label6.InvokeRequired == true)
{
sett3 set = new sett3(max);
label6.Invoke(set, new object[] { respd });
}
else
{
label6.Text = respd.ToString();
}
}
}
}