GUI/MainForm.cs
changeset 403 1d10b3a8a235
parent 402 ded1323b61ee
     1.1 --- a/GUI/MainForm.cs	Thu Apr 18 23:25:10 2013 +0200
     1.2 +++ b/GUI/MainForm.cs	Sun Sep 21 21:55:36 2014 +0200
     1.3 @@ -39,6 +39,7 @@
     1.4      private Color[] plotColorPalette;
     1.5      private SystemTray systemTray;
     1.6      private SoundGraphDisplay soundGraphDisplay;
     1.7 +    private SharpDisplay sharpDisplay;
     1.8      private bool displayTick;
     1.9      private StartupManager startupManager = new StartupManager();
    1.10      private UpdateVisitor updateVisitor = new UpdateVisitor();
    1.11 @@ -57,6 +58,8 @@
    1.12      private UserOption autoStart;
    1.13      private UserOption frontViewPacked; //Tells whether FrontView should cycle or pack sensors
    1.14      private UserOption frontViewDisplayTime; //Tells whether or not FrontView should display current time
    1.15 +    private UserOption sharpDisplayPacked; //Tells whether SharpDisplay should cycle or pack sensors
    1.16 +    private UserOption sharpDisplayShowTime; //Tells whether or not SharpDisplay should display current time
    1.17  
    1.18      private UserOption readMainboardSensors;
    1.19      private UserOption readCpuSensors;
    1.20 @@ -127,14 +130,18 @@
    1.21        treeView.Model = treeModel;
    1.22  
    1.23        this.computer = new Computer(settings);
    1.24 -
    1.25 +       
    1.26 +      //System tray
    1.27        systemTray = new SystemTray(computer, settings, unitManager);
    1.28        systemTray.HideShowCommand += hideShowClick;
    1.29        systemTray.ExitCommand += exitClick;
    1.30    
    1.31 +      //SoundGraph Display
    1.32        soundGraphDisplay = new SoundGraphDisplay(computer, settings, unitManager);
    1.33 - 
    1.34 -
    1.35 +      //Sharp Display Manager
    1.36 +      sharpDisplay = new SharpDisplay(computer, settings, unitManager);
    1.37 +      
    1.38 +      //
    1.39        int p = (int)Environment.OSVersion.Platform;
    1.40        if ((p == 4) || (p == 128)) { // Unix
    1.41          treeView.RowHeight = Math.Max(treeView.RowHeight, 18); 
    1.42 @@ -227,6 +234,10 @@
    1.43        frontViewPacked = new UserOption("frontViewPackedMenuItem", false, frontViewPackedMenuItem, settings);
    1.44        frontViewDisplayTime = new UserOption("frontViewDisplayTimeMenuItem", false, frontViewDisplayTimeMenuItem, settings);
    1.45  
    1.46 +      sharpDisplayPacked = new UserOption("sharpDisplayPackedMenuItem", false, sharpDisplayPackedMenuItem, settings);
    1.47 +      sharpDisplayShowTime = new UserOption("sharpDisplayShowTimeMenuItem", false, sharpDisplayShowTimeMenuItem, settings);
    1.48 +
    1.49 +
    1.50        readMainboardSensors = new UserOption("mainboardMenuItem", true, 
    1.51          mainboardMenuItem, settings);
    1.52        readMainboardSensors.Changed += delegate(object sender, EventArgs e) {
    1.53 @@ -466,6 +477,14 @@
    1.54                SolidBrush greenBrush = new SolidBrush(Color.FromName("mediumspringgreen"));
    1.55                e.BackgroundBrush = greenBrush;
    1.56            }
    1.57 +
    1.58 +          //If displayed in SharpDisplay draw background in blue
    1.59 +          if (sensorNode != null && settings.GetValue(new Identifier(sensorNode.Sensor.Identifier, "SharpDisplay").ToString(), false))
    1.60 +          {
    1.61 +              SolidBrush aquaBrush = new SolidBrush(Color.FromName("aqua"));
    1.62 +              e.BackgroundBrush = aquaBrush;
    1.63 +          }
    1.64 +
    1.65          } else {
    1.66  
    1.67            e.TextColor = Color.DarkGray;
    1.68 @@ -539,8 +558,14 @@
    1.69                soundGraphDisplay.SetText("       -+-", "");
    1.70            }
    1.71            */
    1.72 +      }
    1.73 +
    1.74 +      if (sharpDisplay != null)
    1.75 +      {
    1.76 +          sharpDisplay.Redraw(sharpDisplayPacked.Value, sharpDisplayShowTime.Value);
    1.77        }  
    1.78  
    1.79 +
    1.80      }
    1.81  
    1.82      private void SaveConfiguration() {
    1.83 @@ -603,6 +628,7 @@
    1.84            server.Quit();
    1.85        systemTray.Dispose();
    1.86        soundGraphDisplay.Dispose();
    1.87 +      sharpDisplay.Dispose();
    1.88      }
    1.89  
    1.90      private void aboutMenuItem_Click(object sender, EventArgs e) {
    1.91 @@ -674,6 +700,18 @@
    1.92                };
    1.93                treeContextMenu.MenuItems.Add(item);
    1.94            }
    1.95 +          {
    1.96 +              MenuItem item = new MenuItem("Show in SharpDisplay");
    1.97 +              item.Checked = sharpDisplay.Contains(node.Sensor);
    1.98 +              item.Click += delegate(object obj, EventArgs args)
    1.99 +              {
   1.100 +                  if (item.Checked)
   1.101 +                      sharpDisplay.Remove(node.Sensor);
   1.102 +                  else
   1.103 +                      sharpDisplay.Add(node.Sensor, true);
   1.104 +              };
   1.105 +              treeContextMenu.MenuItems.Add(item);
   1.106 +          }
   1.107            if (gadget != null) {
   1.108              MenuItem item = new MenuItem("Show in Gadget");
   1.109              item.Checked = gadget.Contains(node.Sensor);