/// <summary> /// Shows the auto change dialog when the form is shown /// </summary> private void Main_Shown(object sender, EventArgs e) { if (!autoFired) { if (autoChangeExit && this.WindowState == FormWindowState.Normal) { // Stop the auto change exit timer autoTimer.Stop(); // Report that auto change has been fired autoFired = true; // Show the auto close dialog Auto auto = new Auto(autoSeconds); auto.ShowDialog(); } else if (autoChangeExit && this.WindowState == FormWindowState.Minimized) { // Enable the auto change timer autoTimer.Enabled = true; } } }
/// <summary> /// Stops the timer once the form has been resized (pulled from the taskbar) /// </summary> private void Main_Resize(object sender, EventArgs e) { if (!autoFired) { if (autoChangeExit && this.WindowState == FormWindowState.Normal) { if (autoCounter == 2 || (autoTimer.Enabled)) { // Stop the auto change exit timer autoTimer.Stop(); // Report that auto change has been fired autoFired = true; // Show the auto close dialog Auto auto = new Auto(autoSeconds); auto.ShowDialog(); } // Increase the counter autoCounter++; } } }