Ejemplo n.º 1
0
        // ------------------------------------------------------------------------------
        private void channelMessageReceived(string message)
        {
            Debug.WriteLine(LOG_TAG + ": update was received on channel");

              Debug.WriteLine("\tMessage: " + message);

              MemoryStream stream = new MemoryStream();
              StreamWriter writer = new StreamWriter(stream);
              writer.Write(message);
              writer.Flush();
              stream.Position = 0;

              CollabrifyNotification_PB response = Serializer.DeserializeWithLengthPrefix<CollabrifyNotification_PB>(stream, PrefixStyle.None);
              object specific_response = 0;

              if(response.notification_message_type == NotificationMessageType_PB.NOTIFICATION_MESSAGE_TYPE_NOT_SET)
              {

              }
              else if(response.notification_message_type == NotificationMessageType_PB.ON_CHANNEL_CONNECTED_NOTIFICATION)
              {
            specific_response = Serializer.DeserializeWithLengthPrefix<Notification_OnChannelConnected_PB>(stream, PrefixStyle.None);
              }
              else if(response.notification_message_type == NotificationMessageType_PB.ADD_EVENT_NOTIFICATION)
              {
            specific_response = Serializer.DeserializeWithLengthPrefix<Notification_AddEvent_PB>(stream, PrefixStyle.None);
              }
              else if(response.notification_message_type == NotificationMessageType_PB.ADD_PARTICIPANT_NOTIFICATION)
              {
            specific_response = Serializer.DeserializeWithLengthPrefix<Notification_AddParticipant_PB>(stream, PrefixStyle.None);
              }
              else if(response.notification_message_type == NotificationMessageType_PB.REMOVE_PARTICIPANT_NOTIFICATION)
              {
            specific_response = Serializer.DeserializeWithLengthPrefix<Notification_RemoveParticipant_PB>(stream, PrefixStyle.None);
              }
              else if(response.notification_message_type == NotificationMessageType_PB.END_SESSION_NOTIFICATION)
              {
            specific_response = Serializer.DeserializeWithLengthPrefix<Notification_EndSession_PB>(stream, PrefixStyle.None);
              }
              else if(response.notification_message_type == NotificationMessageType_PB.PREVENT_FURTHER_JOINS_NOTIFICATION)
              {
            specific_response = Serializer.DeserializeWithLengthPrefix<Notification_PreventFurtherJoins_PB>(stream, PrefixStyle.None);
              }
              else if(response.notification_message_type == NotificationMessageType_PB.TRANSIENT_MESSAGE_NOTIFICATION)
              {
            specific_response = Serializer.DeserializeWithLengthPrefix<Notification_TransientMessage_PB>(stream, PrefixStyle.None);
              }

              ChannelEventArgs args = new ChannelEventArgs(response, specific_response);

              if (channelEvent != null) channelEvent.Invoke(args);
        }
Ejemplo n.º 2
0
        // ------------------------------------------------------------------------------
        private void channelNotification(ChannelEventArgs e)
        {
            if (e.type == NotificationMessageType_PB.ADD_EVENT_NOTIFICATION)
              {

              }
              else if (e.type == NotificationMessageType_PB.ADD_PARTICIPANT_NOTIFICATION)
              {

              }
              else if (e.type == NotificationMessageType_PB.END_SESSION_NOTIFICATION)
              {

              }
              else if (e.type == NotificationMessageType_PB.NOTIFICATION_MESSAGE_TYPE_NOT_SET)
              {

              }
              else if (e.type == NotificationMessageType_PB.ON_CHANNEL_CONNECTED_NOTIFICATION)
              {

              }
              else if (e.type == NotificationMessageType_PB.PREVENT_FURTHER_JOINS_NOTIFICATION)
              {

              }
              else if (e.type == NotificationMessageType_PB.REMOVE_PARTICIPANT_NOTIFICATION)
              {

              }
              else if (e.type == NotificationMessageType_PB.TRANSIENT_MESSAGE_NOTIFICATION)
              {

              }
        }
Ejemplo n.º 3
0
 // ------------------------------------------------------------------------------
 private void channelError(string message)
 {
     if (message.Substring(0, message.IndexOf('|')) == "-1")
       {
     Debug.WriteLine(LOG_TAG + ": channelError -1");
     Deployment.Current.Dispatcher.BeginInvoke(delegate
     {
       ChannelEventArgs args = new ChannelEventArgs(null, null);
       if (neg1error != null) neg1error.Invoke(args);
     });
       }
       else
       {
     Debug.WriteLine(LOG_TAG + ": channelError");
     Debug.WriteLine("\tCode: " + message.Substring(0, message.IndexOf('|')));
     Debug.WriteLine("\tDescription: " + message.Substring(message.IndexOf('|') + 1));
       }
 }
Ejemplo n.º 4
0
 private void channelNeg1Error(ChannelEventArgs e)
 {
     Debug.WriteLine(LOG_TAG + ": Channel API Neg 1 error.");
       channelAPI = new ChannelAPI(this, delegate
       {
     //channelAPI.connect(this.notificationID);
       });
       channelAPI.channelEvent += new ChannelEventListener(channelNotification);
       channelAPI.neg1error += new ChannelEventListener(channelNeg1Error);
 }