void CheckUpdateSlientMain(string romfilename) { if (!Open(romfilename)) { return; } if (!CheckUpdateTodayAndOverraideTime(romfilename)) { return; } System.Threading.Thread s1 = new System.Threading.Thread(t => { try { if (this.IsDisposed) { return; } //更新できますか? UPDATE_RESULT ur = CheckUpdate(); if (ur != UPDATE_RESULT.UPDATEABLE) { return; } //イベント通知 if (Application.OpenForms.Count <= 0) {//通知するべきフォームがない. return; } Form f = Application.OpenForms[0]; if (f == null || f.IsDisposed) { return; } EventHandler callback = UpdateThreadCallBackEvent; f.Invoke(callback, new object[] { this, null }); } catch (Exception e) { Log.Error(e.ToString()); return; } }); s1.Start(); }
private void UpdateButton_Click(object sender, EventArgs e) { if (InputFormRef.IsPleaseWaitDialog(this)) {//2重割り込み禁止 return; } //アップデートする準備ができているかどうか。 if (!CheckReady()) { return; } using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) { //更新できますか? UPDATE_RESULT ur = CheckUpdate(); if (ur == UPDATE_RESULT.ERROR) { return; } if (ur == UPDATE_RESULT.LATEST) { if (this.IsSlientMode) { return; } ToolWorkSupport_UpdateQuestionDialogForm f = (ToolWorkSupport_UpdateQuestionDialogForm)InputFormRef.JumpFormLow <ToolWorkSupport_UpdateQuestionDialogForm>(); f.SetVersion(GetUPSDateTimeString()); DialogResult dr = f.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.Retry) { return; } //強制アップデート! } //更新の実行 RunDownloadAndExtract(pleaseWait); } }