protected void setGuiCurrentLaserData(LaserDataSerializable laserData)
        {
            if (_mainWindow != null)
            {
                ccrwpf.Invoke invoke = new ccrwpf.Invoke(
                    delegate()
                {
                    _mainWindow.CurrentLaserData = laserData;       // update sonar sweep control
                    //_mainWindow.setMapper(_mapperVicinity);     // this is pretty much only calling Redraw on the map
                    _mainWindow.RedrawMap();
                }
                    );

                wpfServicePort.Post(invoke);

                Arbiter.Activate(TaskQueue,
                                 invoke.ResponsePort.Choice(
                                     s => { }, // delegate for success
                                     ex => { } //Tracer.Trace(ex) // delegate for failure
                                     ));
            }
        }
 private void SetCurrentLaserData(LaserDataSerializable data)
 {
     this.LidarViewControl.CurrentLaserData = data;
 }
 void lidarLiteProcessor_DataReceived(object sender, LaserDataSerializable data)
 {
     Debug.WriteLine("OK: lidarLiteProcessor_DataReceived");
     Dispatcher.Invoke(new Action<LaserDataSerializable>(SetCurrentLaserData), data);
 }
 void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     //Debug.WriteLine("serialPort_DataReceived");
     try
     {
         string resp = serialPort.ReadLine();
         //Debug.WriteLine("OK: resp='" + resp + "'");
         string[] parts = resp.Split(new char[] { '|' });
         if (parts.Length == 4 && parts[0].StartsWith("*"))
         {
             int count;
             if (int.TryParse(parts[1], out count) && count < 250 && count > 150)
             {
                 string[] sVals = parts[3].Split(new char[] { ' ' });
                 if (sVals.Length > 150)
                 {
                     List<int> values = new List<int>();
                     foreach (string s in sVals)
                     {
                         if ("0123456789".IndexOf(s[0]) >= 0)
                         {
                             int val = int.Parse(s);
                             values.Add(val == 0 ? 4000 : val);
                         }
                     }
                     //Debug.WriteLine("OK: resp parsed to " + values.Count + " readings");
                     if (count == values.Count)
                     {
                         //Debug.WriteLine("OK: good readings");
                         if (DataReceivedEvent != null)
                         {
                             LaserDataSerializable data = new LaserDataSerializable() { TimeStamp = DateTime.Now.Ticks, DistanceMeasurements = values.ToArray() };
                             DataReceivedEvent(this, data);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception exc)
     {
         Debug.WriteLine("Error: serialPort_DataReceived - exception " + exc);
     }
 }