示例#1
0
        private void MainForm_Load(object sender, System.EventArgs e)
        {
            PowerNotifications pn = new PowerNotifications();

            pn.Start();
            pn.PowerStatusChanged += new PowerNotifications.PowerStatusChangeEventHandler(this.PowerNotifications_PowerStatusChanged);

            this.secondPanel.Left = 0;
            this.secondPanel.Top  = 0;

            gravChart   = new LogChart(gravPictureBox.Width, gravPictureBox.Height, 1, 2, 0.2, 90, 60);
            _serialPort = new SerialPort("COM8", 9600);
            if (connected)
            {
                _serialPort           = new SerialPort("COM8", 9600);
                _serialPort.Handshake = Handshake.RequestToSend;
                _serialPort.ReceivedBytesThreshold = 1;
                _serialPort.DataReceived          += new SerialDataReceivedEventHandler(_serialPort_DataReceived);
                //_serialPort.Open();
                //serialPort_open = true;
            }
            else
            {
                testFileName =
                    Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) +
                    Path.DirectorySeparatorChar + testFileName;
                Thread simulationThread = new Thread(new ThreadStart(simulation));
                simulationThreadActive = true;
                simulationThread.Start();
            }

            // Set up the NMEA helper
            nmea       = new NmeaHelper();
            nmea.Grav += new NmeaHelper.GravEventHandler(nmea_Grav);
            this.radLogOff.Checked = true;
        }
        private void MainForm_Load(object sender, System.EventArgs e)
        {
            PowerNotifications pn = new PowerNotifications();
            pn.Start();
            pn.PowerStatusChanged += new PowerNotifications.PowerStatusChangeEventHandler(this.PowerNotifications_PowerStatusChanged);

            this.secondPanel.Left = 0;
            this.secondPanel.Top = 0;

              gravChart = new LogChart(gravPictureBox.Width, gravPictureBox.Height, 1, 2, 0.2, 90, 60);
              _serialPort = new SerialPort("COM8", 9600);
              if(connected)
              {
            _serialPort = new SerialPort("COM8", 9600);
            _serialPort.Handshake = Handshake.RequestToSend;
            _serialPort.ReceivedBytesThreshold = 1;
            _serialPort.DataReceived += new SerialDataReceivedEventHandler(_serialPort_DataReceived);
            //_serialPort.Open();
            //serialPort_open = true;
              }
              else
              {
            testFileName =
              Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) +
              Path.DirectorySeparatorChar + testFileName;
            Thread simulationThread = new Thread(new ThreadStart(simulation));
            simulationThreadActive = true;
            simulationThread.Start();
              }

              // Set up the NMEA helper
              nmea = new NmeaHelper();
              nmea.Grav += new NmeaHelper.GravEventHandler(nmea_Grav);
              this.radLogOff.Checked = true;
        }