Server/MainForm.cs
changeset 51 ae2052cc89ef
parent 50 ba4cad33db58
child 52 b22b0127afa4
     1.1 --- a/Server/MainForm.cs	Sun Aug 31 16:21:50 2014 +0200
     1.2 +++ b/Server/MainForm.cs	Sun Aug 31 17:44:18 2014 +0200
     1.3 @@ -147,6 +147,12 @@
     1.4              {
     1.5                  switch (iDisplay.AttemptRequestCompletion())
     1.6                  {
     1.7 +                    case Display.TMiniDisplayRequest.EMiniDisplayRequestFirmwareRevision:
     1.8 +                        toolStripStatusLabelConnect.Text += " v" + iDisplay.FirmwareRevision();
     1.9 +                        //Issue next request then
    1.10 +                        iDisplay.RequestPowerSupplyStatus();
    1.11 +                        break;
    1.12 +
    1.13                      case Display.TMiniDisplayRequest.EMiniDisplayRequestPowerSupplyStatus:
    1.14                          if (iDisplay.PowerSupplyStatus())
    1.15                          {
    1.16 @@ -162,12 +168,6 @@
    1.17  
    1.18                      case Display.TMiniDisplayRequest.EMiniDisplayRequestDeviceId:
    1.19                          toolStripStatusLabelConnect.Text += " - " + iDisplay.DeviceId();
    1.20 -                        //Issue next request then
    1.21 -                        iDisplay.RequestFirmwareRevision();
    1.22 -                        break;
    1.23 -
    1.24 -                    case Display.TMiniDisplayRequest.EMiniDisplayRequestFirmwareRevision:
    1.25 -                        toolStripStatusLabelConnect.Text += " v" + iDisplay.FirmwareRevision();
    1.26                          //No more request to issue
    1.27                          break;
    1.28                  }
    1.29 @@ -270,7 +270,7 @@
    1.30              if (iDisplay.Open((Display.TMiniDisplayType)cds.DisplayType))
    1.31              {
    1.32                  UpdateStatus();
    1.33 -                iDisplay.RequestPowerSupplyStatus();
    1.34 +                iDisplay.RequestFirmwareRevision();
    1.35              }
    1.36              else
    1.37              {
    1.38 @@ -324,6 +324,12 @@
    1.39              get
    1.40              {
    1.41                  DisplaysSettings settings = Properties.Settings.Default.DisplaySettings;
    1.42 +                if (settings == null)
    1.43 +                {
    1.44 +                    settings = new DisplaysSettings();
    1.45 +                    settings.Init();
    1.46 +                    Properties.Settings.Default.DisplaySettings = settings;
    1.47 +                }
    1.48  
    1.49                  //Make sure all our settings have been created
    1.50                  while (settings.Displays.Count <= Properties.Settings.Default.CurrentDisplayIndex)
    1.51 @@ -827,7 +833,14 @@
    1.52              Properties.Settings.Default.CurrentDisplayIndex = comboBoxDisplayType.SelectedIndex;
    1.53              cds.DisplayType = comboBoxDisplayType.SelectedIndex;
    1.54              Properties.Settings.Default.Save();
    1.55 -            OpenDisplayConnection();
    1.56 +            if (iDisplay.IsOpen())
    1.57 +            {
    1.58 +                OpenDisplayConnection();
    1.59 +            }
    1.60 +            else
    1.61 +            {
    1.62 +                UpdateStatus();
    1.63 +            }
    1.64          }
    1.65  
    1.66  
    1.67 @@ -835,9 +848,14 @@
    1.68          {
    1.69              if (maskedTextBoxTimerInterval.Text != "")
    1.70              {
    1.71 -                timer.Interval = Convert.ToInt32(maskedTextBoxTimerInterval.Text);
    1.72 -                cds.TimerInterval = timer.Interval;
    1.73 -                Properties.Settings.Default.Save();
    1.74 +                int interval = Convert.ToInt32(maskedTextBoxTimerInterval.Text);
    1.75 +
    1.76 +                if (interval > 0)
    1.77 +                {
    1.78 +                    timer.Interval = interval;
    1.79 +                    cds.TimerInterval = timer.Interval;
    1.80 +                    Properties.Settings.Default.Save();
    1.81 +                }
    1.82              }
    1.83          }
    1.84