示例#1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     bool retry = true;
     while (retry)
     {
         try
         {
             _a1 = new ArduinoOne();
             retry = false;
         }
         catch
         {
             var dlg = MessageBox.Show("No Arduino #1 found. Retry?", "No Arduino #1 found", MessageBoxButtons.YesNo);
             if (dlg == DialogResult.No) retry = false;
             Application.Exit();
         }
     }
 }
示例#2
0
 private void InitArduino1()
 {
     bool retry = true;
     while (retry)
     {
         try
         {
             _a1 = new ArduinoOne();
             retry = false;
         }
         catch
         {
             var dlg = MessageBox.Show("No Arduino #1 found. Retry?", "No Arduino #1 found", MessageBoxButtons.YesNo);
             if (dlg == DialogResult.No)
             {
                 retry = false;
                 Application.Exit();
             }
         }
     }
 }