Inheritance: System.EventArgs, INativeEventObjectWrapper
        public void MessageReceiver_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            if (MessageReceived != null)
            {
                MessageReceived.Invoke(this, e);
            }

            Event receivedEvent = Utilities.Deserialize<Event>(e.Message);
            if (receivedEvent != null)
            {
                switch (receivedEvent.Name)
                {
                    case "GetSourceAndPositionCallback":
                        HandleGetSourceAndPositionCallback(receivedEvent);
                        break;
                    case "CurrentStateChanged":
                        HandledCurrentStateChanged(receivedEvent);
                        break;
                    case "GetPlayingStateCallback":
                        HandleGetPlayingStateCallback(receivedEvent);
                        break;
                    case "Seek":
                        HandleSeekEvent(receivedEvent);
                        break;
                    case "ReplayingLastNode":
                        HandleReplayingLastNodeEvent(receivedEvent);
                        break;
                    default:
                        //Debug.WriteLine("Unhandled message received");
                        break;
                }
            }
        }
 public MyMessageReceivedEventArgs(MessageReceivedEventArgs e, string message)
 {
     this.NameScope = e.NameScope;
     this.ReceiverName = e.ReceiverName;
     this.Response = e.Response;
     this.SenderDomain = e.SenderDomain;
     this.Message = message;
 }
Beispiel #3
0
        void messageReceiver_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            string incoming = e.Message;
            if (string.IsNullOrEmpty(incoming)) return;
            string payload;
            string hdr = IPCHelper.ParseResponse(incoming, out payload);

            if (hdr.Equals(IPCHelper.MSGHDR_DATAREQUEST))
            {
                Debug.WriteLine("Header message received through IPC");
                var alertCategory = (AlertsCategory)Enum.Parse(typeof(AlertsCategory), payload, true);
                Debug.WriteLine("Header message received through IPC - alert:" + alertCategory.ToString ());
                AlertsDataTransfer trfr = _vmodel.GetAlertsTransferObject(alertCategory);
                string data = AlertsDataTransfer.SerializeObj(trfr);
                e.Response = IPCHelper.FormatMessage(data, IPCHelper.MSGHDR_DATA);
            }
        }
Beispiel #4
0
 void msgRec_MessageReceived(object sender, MessageReceivedEventArgs e)
 {
     tbkRec.Text = e.Message;
     e.Response = "我受到消息了,谢谢";
 }
Beispiel #5
0
 private void map_MessageReceived(object sender, MessageReceivedEventArgs e)
 {
     Event receivedEvent = Utilities.Deserialize<Event>(e.Message);
     if (receivedEvent != null)
     {
         switch (receivedEvent.Name)
         {
             case "GetPlayingStateCallback":
                 HandleGetPlayingStateCallback(receivedEvent);
                 break;
             default:
                 //Debug.WriteLine("Unhandled message received");
                 break;
         }
     }
 }
		void _receiver_MessageReceived(object sender, MessageReceivedEventArgs e)
		{
			string msg = e.Message;
			if (e.Message == "heartbeat")
			{
				e.Response = "heartbeat";
				return;
			}
			if (e.Message == "beginchunked")
			{
				receivingChunked = true;
				incomingMessage = "";
				return;
			}
			else if (e.Message == "endchunked")
			{
				receivingChunked = false;
				msg = incomingMessage;
			}
			else if (receivingChunked)
			{
				incomingMessage += msg;
				return;
			}
			string[] s = msg.Split('|');
			switch (s[0])
			{
				case "createchannel":
					if (_sender != null)
					{
						_sender.SendCompleted -= new EventHandler<SendCompletedEventArgs>(_sender_SendCompleted);
					}
					_sender = new LocalMessageSender(s[1], LocalMessageSender.Global);
					_sender.SendCompleted += new EventHandler<SendCompletedEventArgs>(_sender_SendCompleted);
					_sender.SendAsync("heartbeat");
					break;
				default:
					if (MessageReceived != null)
					{
						MessageReceived(this, new MyMessageReceivedEventArgs(e, msg));
					}
					break;
			}
		}