/// <summary> /// T2线程 /// </summary> private void ThreadT2Connect(bool reconnect) { Thread.CurrentThread.CurrentUICulture = new CultureInfo(this.addInContainer.Language.ToString()); ShowMsg(Properties.Resources.InitMessage); try { PerformStep(); IT2DataHandler t2 = this.communication.DBFactory.GetT2Data(); if (!reconnect) { // 未连接则建立连接 if (!t2.Connected) { t2.InitT2Connect(t2configFile, 5000); } } else { t2.ReConnect(4000); } Thread.Sleep(1000); } catch (T2CommunicationException exp) { string noteInfo = Properties.Resources.InitFail + "\r\n(" + exp.ToShortString() + ")"; ShowMsg(noteInfo); return; } ShowMsg(Properties.Resources.InitOK); Thread.Sleep(1000); ShowMsg(Properties.Resources.InitEnd); // 是否启动更新 if (AddIn.WinForms.AddInUtility.IsStartAutoUpdate) { this.StartAutoUpdate(); } //PerformStep(); this.FinishStep(); }
/// <summary> /// 启动自动更新线程 /// 在检测到存在更新文件时,弹出更新窗体 /// </summary> private void StartAutoUpdate() { // 强制更新登陆按钮置灰 if (AddInUtility.IsForceUpdate) { this.EnableLogin(false); } else { this.EnableLogin(true); } string location = "FormLogin.StartAutoUpdate"; string logInfo = String.Format("初始化自动更新环境..."); HSLog.LogUpgrade.UpgradeLog(HSLogLevel.INFO, location, module, logInfo); IT2DataHandler t2 = this.communication.DBFactory.GetT2Data(); try { // 初始化文件更新器 t2.InitFileUpdater(10000); t2.FileUpdater.OnReceiveFileList += new OnRecvFileListEventHandler(FileUpdater_OnReceiveFileList); } catch (T2FileUpdateException e) { // TODO: // 登陆按钮激活 this.EnableLogin(true); logInfo = String.Format("初始化自动更新环境失败!\r\n({0})", e.ToShortString()); HSLog.LogUpgrade.UpgradeLog(HSLogLevel.WARN, location, module, logInfo); Hundsun.Framework.UIFrame.MsgBoxUtility.ShowError(logInfo); } }