Fixed: minimize to try

This commit is contained in:
VladMordock
2021-02-17 13:25:34 +01:00
parent 385d1312e2
commit 10c2666e74
2 changed files with 17 additions and 9 deletions

View File

@@ -648,6 +648,7 @@
this.Text = "Perun for DCS";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.form_Main_FormClosing);
this.Load += new System.EventHandler(this.form_Main_Load);
this.Resize += new System.EventHandler(this.form_Main_Resize);
this.con_GroupBox_1.ResumeLayout(false);
this.con_GroupBox_1.PerformLayout();
this.con_GroupBox_2.ResumeLayout(false);

View File

@@ -356,6 +356,7 @@ namespace Perun_v1
// Changed close to try state
Properties.Settings.Default.CLOSE_TO_TRAY = con_check_minimize_to_tray.Checked;
}
// ################################ Form state ################################
private void con_Button_Quit_Click(object sender, EventArgs e)
{
@@ -407,15 +408,9 @@ namespace Perun_v1
if (e.CloseReason == CloseReason.UserClosing && !AppCanClose)
{
e.Cancel = true;
if (Properties.Settings.Default.CLOSE_TO_TRAY)
{
form_Main_SendToTray(); // Send app to system tray
} else
{
con_Button_Quit_Click(sender, e);
}
}
}
private void trayIconMain_MouseDoubleClick(object sender, MouseEventArgs e)
{
@@ -423,6 +418,17 @@ namespace Perun_v1
form_Main_BringFromTray(); // Bring app from system tray
}
private void form_Main_Resize(object sender, EventArgs e)
{
// Form was minimised to try
if (WindowState == FormWindowState.Minimized)
{
if (con_check_minimize_to_tray.Checked)
{
form_Main_SendToTray();
}
}
}
// ################################ Timers ################################
private void Tim_GUI_Tick(object sender, EventArgs e)
{
@@ -716,5 +722,6 @@ namespace Perun_v1
{
}
}
}