private void ConfirmSensors()
        {
            log.Append("Confirming sensors - connected sensors are:");
             foreach (SensorDefinition sensor in CurrentServerData.sensors)
             {
            log.Append(sensor.Description);
             }
             log.Append("End of sensors");

             if (CurrentServerData.sensors.NoneConnected())
             {
            log.Append("No sensors connected!");
            DialogResult result = MessageBox.Show("No sensors are currently identified, would you like to connect to a Logbook now? (Otherwise dummy sensors will be used.)", "No Sensors Connected",
               MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            if (result == DialogResult.Yes)
            {
               ConnectLogbookAndIdentifySensors();
               if (CurrentServerData.sensors.NoneConnected())
               {
                  log.Append("Still no sensors connected!");

                  result = MessageBox.Show("The connection to the Logbook could not be established or no sensors are connected, try manual connection?", "Connection Problem",
                     MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                  if (result == DialogResult.Yes)
                  {
                     log.Append("Using manual connection!");
                     ConnectLogbookForm connectForm = new ConnectLogbookForm(logbook);
                     connectForm.ShowDialog();
                  }
                  if (CurrentServerData.sensors.NoneConnected())
                  {
                     log.Append("Continuing with no sensors...");
                     CurrentSensors = new SensorDefinition[4];
                     CurrentServerData.sensors.Clear();
                     for (int i = 0; i < 4; i++)
                     {
                        CurrentServerData.sensors.Add(new SensorDefinition());
                        CurrentSensors[i] = CurrentServerData.sensors[i];
                     }
                  }
               }
            }
            else
            {
               log.Append("Continuing with dummy sensors");
               CurrentServerData.sensors.Clear();
               for (int i = 0; i < 4; i++)
               {
                  CurrentServerData.sensors.Add(new SensorDefinition());
               }
            }
             }
        }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     connectForm = new ConnectLogbookForm(logbook);
      connectForm.ShowDialog();
 }