Inheritance: System.EventArgs
Exemplo n.º 1
0
 void networkNode_MessageReceived(object sender, MessageEventArgs args)
 {
     log.Append("networkNode_MessageReceived", String.Format("Message Received from {0}", args.SenderID.ToString()));
      TypedMessage message = new TypedMessage(args.Data, args.Data.Length);
      switch (message.type)
      {
     case MessageType.DescriptionRequest:
        log.Append("networkNode_MessageReceived", "Description Request received");
        DescriptionMessage description = new DescriptionMessage(CurrentServerData);
        TypedMessage reply = new TypedMessage(MessageType.DescriptionMessage, description.GetBytes());
        networkNode.SendDirect(reply.GetBytes(), args.SenderID);
        break;
     default:
        break;
      }
 }
Exemplo n.º 2
0
 void networkNode_MessageReceived(object sender, MessageEventArgs args)
 {
     try
      {
     log.Append("networkNode_MessageReceived", String.Format("Message Received from {0}", args.SenderID.ToString()));
     TypedMessage message = new TypedMessage(args.Data, args.Data.GetLength(0));
     switch (message.type)
     {
        case MessageType.AliveMessage:
           ProcessAliveMessage(args.SenderID, message.data);
           break;
        case MessageType.DescriptionMessage:
           ProcessDescriptionMessage(args.SenderID, message);
           break;
        default:
           break;
     }
      }
      catch (Exception ex)
      {
     log.LogException(ex, "Exception when processing message");
     MessageBox.Show(ex.Message, "Exception :(");
      }
 }
Exemplo n.º 3
0
 void client_MessageReceived(object sender, MessageEventArgs a)
 {
     TypedMessage message = new TypedMessage(a.Data, a.Data.Length);
      switch (message.type)
      {
     case MessageType.SensorReadingsData:
        SensorReadingsData data = MessageHelper.DeserializeSensorReadingsData(message.data);
        this.timeOffset = data.Time.Ticks - DateTime.Now.Ticks;
        break;
      }
 }