void Connict_ConnictFinish(object sender, ConnictFinishEventArgs e) { var cnnt = sender as Device.Connection; if (e.Reason == ConnectionFinishReasons.Bootloader) { this.BeginInvoke(new UIHelper.UIInvoke(SetFirewareState)); } else { if (cnnt.IsConnected) { System.Diagnostics.Debug.WriteLine("连接成功"); Services.RealyDataPre.Begin(); Services.Device.BeginOnTimeTask(OnTimeTasks.GetRealyTimeData); System.Threading.Thread.Sleep(500); Services.Stroe.LoadAuto(); this.BeginInvoke(new UIHelper.UIInvoke(this.Close)); } else { if (ports.Length > index + 1) { cnnt.InitConnecting(ports[++index]); } else { System.Diagnostics.Debug.WriteLine("连接失败"); Services.Stroe.LoadAuto(); this.BeginInvoke(new UIHelper.UIInvoke(this.Close)); } } } }
void Connict_ConnictFinish(object sender, ConnictFinishEventArgs e) { var cnnt = sender as Device.Connection; if (e.Reason == ConnectionFinishReasons.Bootloader) { RequestPasswordBind(false); cnnt.InitConnictFinish -= Connict_ConnictFinish; this.BeginInvoke(new UIHelper.UIInvoke(ShowUpECUForm)); } else { if (cnnt.IsConnected) { System.Diagnostics.Debug.WriteLine("连接成功"); // IGT.Service.SSer.Device = Services.Device; IGT.Service.SSer.Device = Services.Device; RequestPasswordBind(false); cnnt.InitConnictFinish -= Connict_ConnictFinish; this.BeginInvoke(new UIHelper.UIINvkoeParam1 <bool>(GoMainForm), false); } else { if (ports.Length > index + 1) { cnnt.InitConnecting(ports[++index]); } else { System.Diagnostics.Debug.WriteLine("连接失败"); RequestPasswordBind(false); cnnt.InitConnictFinish -= Connict_ConnictFinish; this.BeginInvoke(new UIHelper.UIINvkoeParam1 <bool>(GoMainForm), e.Reason == ConnectionFinishReasons.NoRespose); } } } }