public void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { _done = true; Thread.Sleep(1000); //########### //this.Close(); //Close(); //Application.Exit(); //########### this.Hide(); this.Close(); if (UserSettings.MinimiseonStartup == true) { WOTTrayApp sysTray = new WOTTrayApp(); sysTray.Show(); } else { if (WOTStatistics.Core.UserSettings.AppVersion != WOTStatistics.Core.UserSettings.LastReleaseNotes) { try { WOTStatistics.Core.UserSettings.LastReleaseNotes = WOTStatistics.Core.UserSettings.AppVersion; string sVersion = "ReleaseNote_" + WOTStatistics.Core.UserSettings.AppVersion.Replace(".", string.Empty) + ".htm"; ReleaseNotes oRN = new ReleaseNotes(); oRN.LoadPage(Path.Combine(WOTStatistics.Core.WOTHelper.GetApplicationData(), sVersion)); oRN.ShowDialog(); oRN.BringToFront(); } catch (Exception exrn) { WOTHelper.AddToLog("Release Notes: " + exrn.Message); } } frmMain frm = new frmMain(); WOTHelper.AddToLog("Starting Main Form..."); frm.Show(); WOTHelper.AddToLog("Starting Main Form DONE"); } _workerThread.Dispose(); this.Dispose(); }
private void button1_Click(object sender, EventArgs e) { if (_workerThread.IsBusy) { _cancel = true; _workerThread.CancelAsync(); } else { this.Hide(); this.Close(); frmMain frm = new frmMain(); frm.Show(); _workerThread.Dispose(); this.Dispose(); } }