Example #1
0
 /*
  * peforms initial setup and makes sure that there is a valid device connected
  */
 private void Form1_Load(object sender, EventArgs e)
 {
     varHolder              = new Variables();
     running                = true;
     this.textDelegate      = new SetTextDelegate(DisplayMessage);
     this.myDelegate_button = new AddDataDelegate_button(setButtonLEDText);
     this.serialDelegate    = new setSerialDelegate(setSerial);
     this.firmwrDelegate    = new setFirmwrDelegate(setFirmware);
     this.timeDelegate      = new setTimeDelegate(setTime);
     this.listBoxDelegate   = new addListBoxDelegate(setListBox);
     if (setPort())
     {
         //try to establish a connection
         serialPort1.WriteLine(STATE);   //get the state of the LED
         serialPort1.WriteLine(INFO);    //get the serial number and firmware
         serialPort1.WriteLine(GETTIME); //get the time from the board
         serialPort1.WriteLine(GETVARS); //get the variables from the running program
                                         //start new thread to handle periodically getting the time
         Thread timeThread = new Thread(new ThreadStart(this.startTimeThread));
         timeThread.IsBackground = true;
         timeThread.Start();
     }
     else
     {
         MessageBox.Show("No device detected" + "\n", "Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Close();
     }
 }
Example #2
0
 public ProgressBar(Flag isCreated, Object locker, Flag cancel, string message)
 {
     InitializeComponent();
     this.cancel        = cancel;
     this.isCreated     = isCreated;
     this.locker        = locker;
     this.message       = message;
     timer              = new System.Windows.Forms.Timer();
     percentageDelegate = new setPercentageDelegate(this.Setpercentage);
     timeDelegate       = new setTimeDelegate(SetTime);
     closeFormDelegate  = new closeDelegate(this.CloseFormMethod);
     EditTitleBar();
 }