GUI/MainForm.cs
changeset 55 898935080fd6
parent 42 47385d4fc990
child 57 142907c75be4
     1.1 --- a/GUI/MainForm.cs	Fri Feb 19 18:33:08 2010 +0000
     1.2 +++ b/GUI/MainForm.cs	Fri Feb 19 19:50:07 2010 +0000
     1.3 @@ -134,6 +134,7 @@
     1.4        maxMenuItem.Checked = Config.Get(maxMenuItem.Name, true);
     1.5        limitMenuItem.Checked = Config.Get(limitMenuItem.Name, false);
     1.6  
     1.7 +      startMinMenuItem.Checked = Config.Get(startMinMenuItem.Name, false); 
     1.8        minTrayMenuItem.Checked = Config.Get(minTrayMenuItem.Name, true);
     1.9        hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true);
    1.10  
    1.11 @@ -143,7 +144,18 @@
    1.12        tempMenuItem.Checked = Config.Get(tempMenuItem.Name, true);
    1.13        fansMenuItem.Checked = Config.Get(fansMenuItem.Name, true);
    1.14       
    1.15 -      timer.Enabled = true;   
    1.16 +      timer.Enabled = true;
    1.17 +
    1.18 +      if (startMinMenuItem.Checked) {
    1.19 +        if (minTrayMenuItem.Checked) {
    1.20 +          notifyIcon.Visible = true;
    1.21 +        } else {
    1.22 +          WindowState = FormWindowState.Minimized;
    1.23 +          Show();
    1.24 +        }
    1.25 +      } else {
    1.26 +        Show();
    1.27 +      }
    1.28      }
    1.29  
    1.30      private void HardwareAdded(IHardware hardware) {
    1.31 @@ -238,6 +250,7 @@
    1.32        Config.Set(maxMenuItem.Name, maxMenuItem.Checked);
    1.33        Config.Set(limitMenuItem.Name, limitMenuItem.Checked);
    1.34  
    1.35 +      Config.Set(startMinMenuItem.Name, startMinMenuItem.Checked);
    1.36        Config.Set(minTrayMenuItem.Name, minTrayMenuItem.Checked);
    1.37        Config.Set(hddMenuItem.Name, hddMenuItem.Checked);
    1.38  
    1.39 @@ -346,13 +359,13 @@
    1.40      }
    1.41  
    1.42      private void ToggleSysTray() {
    1.43 -      if (Visible) {
    1.44 -        notifyIcon.Visible = true;
    1.45 -        Visible = false;        
    1.46 -      } else {
    1.47 +      if (notifyIcon.Visible) {
    1.48          Visible = true;
    1.49          notifyIcon.Visible = false;
    1.50 -        Activate();
    1.51 +        Activate(); 
    1.52 +      } else {
    1.53 +        notifyIcon.Visible = true;
    1.54 +        Visible = false;           
    1.55        }
    1.56      }
    1.57  
    1.58 @@ -382,6 +395,5 @@
    1.59  
    1.60        sensorSystemTray.Remove(sensor);
    1.61      }
    1.62 -
    1.63    }
    1.64  }