/// <summary> /// Called by FormConfiguration when being closed after a save or cancel. /// </summary> public void FormConfigurationClosed() { FormConfiguration = null; //If form was forcefully hidden then reveal it again. if (FormForcefullyHidden) { FormForcefullyHidden = false; ShowAlert(); } /* Check if interval timer is enabled. If not this may be * the first time the app is run. Perform an instant check. */ if (!IntervalTimer.Enabled) { CheckForUpdate(); } }
/// <summary> /// Called when form loads. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { LoadConfiguration(); AnchorForm(); HideAlert(); if (ConfigurationIncomplete()) { MessageBox.Show("Program is not yet configured. You will be prompted to configure the program after clicking OK.", "Live Alert", MessageBoxButtons.OK); FormConfiguration = new FormConfiguration(); FormConfiguration.Initialize(this); FormConfiguration.Show(); return; } CheckForUpdate(); }
/// <summary> /// Called when system tray icon is clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NotificationIcon_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { //Only allow this action if application is configured. if (ConfigurationIncomplete()) { return; } //if FormConfiguration is shown dispose of it. if (FormConfiguration != null) { FormConfiguration.Dispose(); FormConfiguration = null; } if (this.Visible) { FormForcefullyHidden = true; } HideAlert(); //If send/submit message form is already open place it on top again. if (FormSubmit != null) { FormSubmit.AnchorForm(); FormSubmit.SendToTop(); FormSubmit.Show(); } //If send/submit message form isn't open make a new one and show it. else { FormSubmit = new FormSubmit(); FormSubmit.Initialize(this); FormSubmit.Show(); } } //else if (e.Button == MouseButtons.Right) // Debug.Print("Right clicked"); }