コード例 #1
0
ファイル: Form1.cs プロジェクト: blax3k/prostheticGUI
 /*
  * 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();
     }
 }
コード例 #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     serialPort1.Open();                                                        //Opening the serial port
     this.myDelegate        = new AddDataDelegate(AddDataMethod);               //Assigning  "the function that changes richtextbox text" to the delegate
     this.myDelegate_button = new AddDataDelegate_button(AddDataMethod_button); //Assigning "the function that changes button text" to the delegate
     //serialPort1.WriteLine("STATE");
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: seamusos/Arduino-Serial-Tool
 private void Form1_Load_1(object sender, EventArgs e)
 {
     InitSerial();
     this.myDelegate        = new AddDataDelegate(AddDataMethod);               //Assigning "the function that changes richtextbox text" to the delegate
     this.myDelegate_button = new AddDataDelegate_button(AddDataMethod_button); //Assigning "the function that changes button text" to the delegate
     cpuCounter             = new PerformanceCounter("Processor", "% Processor Time", "_Total");
     ramCounter             = new PerformanceCounter("Memory", "Available MBytes");
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: MadeOfBricks/EpicEscapeJeff
        private void Form1_Load(object sender, EventArgs e)
        {
            string fileString = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/testFile.txt";

            //System.IO.File.Create(fileString);
            System.IO.File.WriteAllText(fileString, "X\r\nX");
            try
            {
                serialPort3.Open();//Opening the serial port
            } catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            this.myDelegate        = new AddDataDelegate(AddDataMethod);               //Assigning "the function that changes richtextbox text" to the delegate
            this.myDelegate_button = new AddDataDelegate_button(AddDataMethod_button); //Assigning "the function that changes button text" to the delegate
        }