private void gpcDevicesInfo_CustomButtonClick(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e) { if (e.Button.Properties.Caption == "搜索设备") { if (!this.ExcuteSearchDevices()) { return; } //if(this.IsBusy) //{ // return; //} //f_DevicesDataTable.Clear(); //if(!this.SearchDevices()) //{ // return; //} ////发送报文成功开始计时 //this.BeginTick = Environment.TickCount; //this.CoolingTick = 3000; //this.IsBusy = true; //f_SearchDevicesCount = 2; //剩余自动广播次数 HintProvider.StartWaiting(null, "正在搜索设备", "", Application.ProductName, showDelay: 0, showCloseButtonDelay: int.MaxValue); //this.tmrCommunication.Start(); } }
/// <summary> /// 动态加载窗体到pnlReportContainer /// </summary> /// <typeparam name="T"></typeparam> /// <param name="ucName"></param> private void ShowUserControl <T>(string ucName) where T : GeneralDeviceUserControl { foreach (GeneralDeviceUserControl userControl in f_UserControls.Values) { userControl.Visible = false; } if (f_UserControls.ContainsKey(ucName)) { GeneralUserControl uc = f_UserControls[ucName]; uc.Visible = true; uc.BringToFront(); return; } HintProvider.StartWaiting(null, "正在加载", "", Application.ProductName, showDelay: 0, showCloseButtonDelay: int.MaxValue); T t = UtilityTool.ShowUserControl <T>(this.pnlReportContainer); //绑定udp监听器到pnlReportContainer t.UdpListener = f_UdpListener; //绑定接收数据的函数 t.UdpListener.RecvCallback += t.RecvCallBack; f_UserControls.Add(ucName, t); }