GUI/MainForm.cs
branchMiniDisplay
changeset 445 fe4c711fd7f8
parent 444 9b09e2ee0968
     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 @@ -131,14 +134,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 @@ -233,6 +240,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 @@ -499,6 +510,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 @@ -571,6 +590,11 @@
    1.69            */
    1.70        }  
    1.71  
    1.72 +      if (sharpDisplay != null)
    1.73 +      {
    1.74 +          sharpDisplay.Redraw(sharpDisplayPacked.Value, sharpDisplayShowTime.Value);
    1.75 +      }  
    1.76 +
    1.77  
    1.78        if (logSensors != null && logSensors.Value && delayCount >= 4)
    1.79          logger.Log();
    1.80 @@ -640,6 +664,7 @@
    1.81            server.Quit();
    1.82        systemTray.Dispose();
    1.83        soundGraphDisplay.Dispose();
    1.84 +      sharpDisplay.Dispose();
    1.85      }
    1.86  
    1.87      private void aboutMenuItem_Click(object sender, EventArgs e) {
    1.88 @@ -711,6 +736,18 @@
    1.89                };
    1.90                treeContextMenu.MenuItems.Add(item);
    1.91            }
    1.92 +          {
    1.93 +              MenuItem item = new MenuItem("Show in SharpDisplay");
    1.94 +              item.Checked = sharpDisplay.Contains(node.Sensor);
    1.95 +              item.Click += delegate(object obj, EventArgs args)
    1.96 +              {
    1.97 +                  if (item.Checked)
    1.98 +                      sharpDisplay.Remove(node.Sensor);
    1.99 +                  else
   1.100 +                      sharpDisplay.Add(node.Sensor, true);
   1.101 +              };
   1.102 +              treeContextMenu.MenuItems.Add(item);
   1.103 +          }
   1.104            if (gadget != null) {
   1.105              MenuItem item = new MenuItem("Show in Gadget");
   1.106              item.Checked = gadget.Contains(node.Sensor);