// This method is virtual to ensure that it can be overridden in a derived class.
 protected virtual void OnRovStateReceived(DataReceivedEventArgs e)
 {
     EventHandler<DataReceivedEventArgs> handler = RovStateReceived;
     if (handler != null)
     {
         handler(this, e);
     }
 }
Example #2
0
 private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     SerialPort port = (SerialPort)sender;
     buffer = new Byte[port.BytesToRead];
     port.Read(buffer, 0, buffer.Length);
     DataReceivedEventArgs args = new DataReceivedEventArgs();
     args.Data = buffer;
     OnDataReceived(args);
 }
 private void invokePacketReceived()
 {
     DataReceivedEventArgs args = new DataReceivedEventArgs();
     args.Data = inputBuffer.ToArray();
     OnRovStateReceived(args);
 }
 private void comServer_RovStateReceived(object sender, DataReceivedEventArgs e)
 {
     handleStateChanged(readRovState(e.Data));
 }
        private void ComPort_DataReceived(object sender, DataReceivedEventArgs args)
        {
            try
            {
                if (InvokeRequired)
                {
                    if (!this.IsDisposed)
                    {
                        this.Invoke(new Action(() => readRovState(args.Data)));
                        return;
                    }

                }
            }
            catch (ObjectDisposedException)
            {
                // NOT YET IMPLEMENTED
            }
        }
 private void RovState_Received(object sender, DataReceivedEventArgs e)
 {
     try
     {
         if (InvokeRequired)
         {
             if (!this.IsDisposed)
             {
                 this.txtOutput.BeginInvoke(new MethodInvoker(delegate() { readOutputData(); }));
                 this.txtInput.BeginInvoke(new MethodInvoker(delegate() { readRovState(e.Data); }));
                 return;
             }
         }
     }
     catch (ObjectDisposedException)
     {
         // NOT YET IMPLEMENTED
     }
 }