#region 委托
/// <summary>
/// 日志
/// </summary>
/// <param name="s"></param>
private delegate void MyAddLog(string str);
private static event MyAddLog AddLog;
private void EventAddLog(string msg)
{
tb_msg.AppendText(DateTime.Now.ToString("HH:mm:ss") + " " + msg + " \r\n");
}
/// <summary>
/// 监听总数
/// </summary>
/// <param name="num"></param>
private delegate void MyDeviceCount(int num);
private static event MyDeviceCount DeviceCountChange;
private void EventDeviceCount(int num)
{
label_jianting_count.Text = num.ToString();
}
#endregion
private void Form1_Load(object sender, EventArgs e)
{
CheckForIllegalCrossThreadCalls = false;
//绑定委托
AddLog += EventAddLog;
DeviceCountChange += EventDeviceCount;
}