void _messengerWorker_ReadMarkerCompleted(IMessenger sender, ColorMarkerResponseMessage obj)
        {
            Color color = Color.FromRgb(obj.R, obj.G, obj.B);

            if (_markersToLoadCount > 0)
            {
                // MODE A: loading collection of markers

                --_markersToLoadCount;

                SCSColorMarker marker = new SCSColorMarker();
                marker.TimePoint = obj.TimePoint;
                marker.Color     = color;
                _loadedMarkers.Add(marker);

                if (_markersToLoadCount == 0)
                {
                    UIDispatcher.Current.BeginInvoke(new Action(() =>
                    {
                        _sliderCanvasService.SetMarkers(_loadedMarkers);
                    }));
                }
            }
            else
            {
                // MODE B: loading single marker

                UIDispatcher.Current.BeginInvoke(new Action(() =>
                {
                    _sliderCanvasService.SetMarkerColor(obj.MarkerIndex, color);
                }));
            }
        }
Example #2
0
 public void LoadMarker(byte markerIndex)
 {
     if (ReadMarkerCompleted != null)
     {
         ColorMarkerResponseMessage respMsg = new ColorMarkerResponseMessage()
         {
             MarkerIndex = markerIndex, TimePoint = (byte)(255 * markerIndex / (_markerColors.Count - 1))
         };
         respMsg.R = _markerColors[markerIndex].R;
         respMsg.G = _markerColors[markerIndex].G;
         respMsg.B = _markerColors[markerIndex].B;
         ReadMarkerCompleted(this, respMsg);
     }
 }
Example #3
0
        void _rs_FrameReceived(FrameReceiverState obj)
        {
            switch (_messageType)
            {
            case MessageType.GetMarker:
                if (ReadMarkerCompleted != null)
                {
                    _colorMarkerResponseMessage             = new ColorMarkerResponseMessage();
                    _colorMarkerResponseMessage.TimePoint   = obj.PayloadBuff[0];
                    _colorMarkerResponseMessage.R           = obj.PayloadBuff[1];
                    _colorMarkerResponseMessage.G           = obj.PayloadBuff[2];
                    _colorMarkerResponseMessage.B           = obj.PayloadBuff[3];
                    _colorMarkerResponseMessage.MarkerIndex = _markerIndex;
                    ReadMarkerCompleted(this, _colorMarkerResponseMessage);
                }
                break;

            case MessageType.GetMarkerCount:
                if (ReadMarkerCountCompleted != null)
                {
                    _colorMarkerCountResponseMessage = new ColorMarkerCountResponseMessage()
                    {
                        MarkerCount = obj.PayloadBuff[0]
                    };
                    ReadMarkerCountCompleted(this, _colorMarkerCountResponseMessage);
                }
                break;

            case MessageType.GetTimeSpan:
                if (ReadTimeSpanCompleted != null)
                {
                    _timeSpanResponseMessage           = new TimeSpanResponseMessage();
                    _timeSpanResponseMessage.TimeSpan  = obj.PayloadBuff[0];
                    _timeSpanResponseMessage.TimeSpan |= (UInt16)((UInt16)obj.PayloadBuff[1] << 8);
                    ReadTimeSpanCompleted(this, _timeSpanResponseMessage);
                }
                break;

            case MessageType.GetTimeProgress:
                if (ReadTimeProgressCompleted != null)
                {
                    _timeProgressResponseMessage = new TimeProgressResponseMessage();
                    _timeProgressResponseMessage.TimeProgress  = obj.PayloadBuff[0];
                    _timeProgressResponseMessage.TimeProgress |= (UInt16)((UInt16)obj.PayloadBuff[1] << 8);
                    ReadTimeProgressCompleted(this, _timeProgressResponseMessage);
                }
                break;

            case MessageType.GetSystemStateFlags:
                if (ReadSystemStateFlagsCompleted != null)
                {
                    _systemStateFlagsResponseMessage      = new SystemStateFlagsResponseMessage();
                    _systemStateFlagsResponseMessage.Data = obj.PayloadBuff;
                    ReadSystemStateFlagsCompleted(this, _systemStateFlagsResponseMessage);
                }
                break;
            }

            _messageType     = MessageType.Undefined;
            _pendingResponse = false;
        }
Example #4
0
 void _messenger_ReadMarkerCompleted(IMessenger sender, ColorMarkerResponseMessage obj)
 {
     RaiseEventAction(ReadMarkerCompleted, obj);
 }