Exemple #1
0
 private void OnDataArrived(ComService sender, DataArrivedArgs args)
 {
     if (DataArrived != null)
     {
         DataArrived(sender, args);
     }
 }
Exemple #2
0
        void ComService_DataArrived(object sender, DataArrivedArgs eArg)
        {
            DataArrivedArgs e = eArg;

            this.BeginInvoke(() =>
            {
                try
                {
                    _packetReceived.Text = e.PacketType + " (" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + ")";
                    if (e.PacketType == PacketType.PollData)
                    {
                        string str = Encoding.ASCII.GetString(e.Data);
                        str        = str.Substring(1); // remove prefix
                        var parts  = str.Split('\t');
                        int rpms   = int.Parse(parts[0]);
                        _rpms.Text = rpms.ToString();
                    }
                }
                catch (Exception)
                {
                    // todo: for some reason this will throw if connection is lost
                }
            });
        }
Exemple #3
0
 private void OnDataArrived(ComService sender, DataArrivedArgs args)
 {
     if (DataArrived != null)
     {
         DataArrived(sender, args);
     }
 }