private static void ShowForm() { splashForm = new SplashForm(); Application.Run(splashForm); }
private static void CloseFormInternal() { splashForm.Close(); splashForm = null; }
private bool StopMailpile() { bool ok = true; if (!this.mailpile.HasExited) { SplashForm.ShowSplashScreen(); string value = ConfigurationManager.AppSettings["REQ_Quit"]; HttpWebRequest request; HttpWebResponse response; if (!value.Equals("")) { try { request = (HttpWebRequest)WebRequest.Create(value); } catch (Exception ex) { MessageBox.Show("Unable to stop Mailpile." + Environment.NewLine + "Exception: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); request = null; ok = false; } if (ok) { try { response = (HttpWebResponse)request.GetResponse(); } catch (Exception ex) { ok = false; response = null; } } else { response = null; } if (!ok) { // no response from connection return(true); } int statusCode = (int)response.StatusCode; if (statusCode == (int)Status.OK) { string wait_s = ConfigurationManager.AppSettings["Quit_wait"]; int wait; try { wait = Convert.ToInt32(wait_s); } catch (Exception ex) { MessageBox.Show("Cannot convert \"Quit_wait\" to int32." + Environment.NewLine + "Exception: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); wait = 0; } Thread.Sleep(wait); return(true); } else { MessageBox.Show("Unable to stop mailpile, HTTP response: " + statusCode.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); SplashForm.CloseSplashScreen(); return(false); } } else { if (!this.mailpile.CloseMainWindow()) { ok = false; } } } return(ok); }