GUI/SoundGraphDisplay.cs
branchMiniDisplay
changeset 438 f590956d3234
parent 437 38e7b78cf732
child 439 06369ace500d
     1.1 --- a/GUI/SoundGraphDisplay.cs	Mon Feb 02 13:28:41 2015 +0100
     1.2 +++ b/GUI/SoundGraphDisplay.cs	Sat Apr 13 00:43:25 2013 +0200
     1.3 @@ -36,6 +36,8 @@
     1.4          private List<SensorFrontView> list = new List<SensorFrontView>();
     1.5          private SoundGraph.Server iServer;
     1.6  
     1.7 +        private int nextSensorToDisplay=0;
     1.8 +
     1.9  
    1.10          public SoundGraphDisplay(IComputer computer, PersistentSettings settings,
    1.11            UnitManager unitManager)
    1.12 @@ -88,7 +90,7 @@
    1.13          private void SensorAdded(ISensor sensor)
    1.14          {
    1.15              if (settings.GetValue(new Identifier(sensor.Identifier,
    1.16 -              "tray").ToString(), false))
    1.17 +              "FrontView").ToString(), false))
    1.18                  Add(sensor, false);
    1.19          }
    1.20  
    1.21 @@ -110,8 +112,29 @@
    1.22  
    1.23          public void Redraw()
    1.24          {
    1.25 -            foreach (SensorFrontView icon in list)
    1.26 -                icon.Update();
    1.27 +            //TODO: construct our two lines of texts, scroll or alternate sensors
    1.28 +            foreach (SensorFrontView sensor in list)
    1.29 +            {
    1.30 +                sensor.Update();
    1.31 +                //SetText(sensor.iFirstLine, sensor.iSecondLine);
    1.32 +            }
    1.33 +
    1.34 +            //Alternate between sensors 
    1.35 +            if (list.Count > 0)
    1.36 +            {
    1.37 +                SetText(list[nextSensorToDisplay].iFirstLine, list[nextSensorToDisplay].iSecondLine);
    1.38 +                nextSensorToDisplay++;
    1.39 +            }
    1.40 +
    1.41 +            if (nextSensorToDisplay == list.Count)
    1.42 +            {
    1.43 +                //Go back to first sensor
    1.44 +                nextSensorToDisplay = 0;
    1.45 +            }
    1.46 +
    1.47 +
    1.48 +            //
    1.49 +            
    1.50          }
    1.51  
    1.52          public bool Contains(ISensor sensor)
    1.53 @@ -131,15 +154,18 @@
    1.54              else
    1.55              {
    1.56                  //SL:
    1.57 -                //list.Add(new SensorFrontView(this, sensor, balloonTip, settings, unitManager));
    1.58 +                list.Add(new SensorFrontView(this, sensor, balloonTip, settings, unitManager));
    1.59                  //UpdateMainIconVisibilty();
    1.60 -                //settings.SetValue(new Identifier(sensor.Identifier, "tray").ToString(), true);
    1.61 +                settings.SetValue(new Identifier(sensor.Identifier, "FrontView").ToString(), true);
    1.62 +                nextSensorToDisplay = 0;
    1.63              }
    1.64 +
    1.65          }
    1.66  
    1.67          public void Remove(ISensor sensor)
    1.68          {
    1.69              Remove(sensor, true);
    1.70 +            nextSensorToDisplay = 0;
    1.71          }
    1.72  
    1.73          private void Remove(ISensor sensor, bool deleteConfig)
    1.74 @@ -147,9 +173,7 @@
    1.75              if (deleteConfig)
    1.76              {
    1.77                  settings.Remove(
    1.78 -                  new Identifier(sensor.Identifier, "tray").ToString());
    1.79 -                settings.Remove(
    1.80 -                  new Identifier(sensor.Identifier, "traycolor").ToString());
    1.81 +                  new Identifier(sensor.Identifier, "FrontView").ToString());
    1.82              }
    1.83              SensorFrontView instance = null;
    1.84              foreach (SensorFrontView icon in list)
    1.85 @@ -158,7 +182,7 @@
    1.86              if (instance != null)
    1.87              {
    1.88                  list.Remove(instance);
    1.89 -                UpdateMainIconVisibilty();
    1.90 +                //UpdateMainIconVisibilty();
    1.91                  instance.Dispose();
    1.92              }
    1.93          }
    1.94 @@ -191,7 +215,7 @@
    1.95  
    1.96          public void SetText(string aUpperLine, string aLowerLine)
    1.97          {
    1.98 -            iServer.SendMessage("set-vfd-text:" + aUpperLine);
    1.99 +            iServer.SendMessage("set-vfd-text:" + aUpperLine + "\n" + aLowerLine);
   1.100          }
   1.101  
   1.102          public void Quit()