Beispiel #1
0
 public ChannelEventArgs(CollabrifyNotification_PB response_pb, object specific_response_pb)
 {
     if (response_pb != null)
     {
         response           = response_pb;
         type               = response_pb.notification_message_type;
         specificResponsePB = specific_response_pb;
     }
 } // CTOR
Beispiel #2
0
        } // channelError

        // ------------------------------------------------------------------------------

        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);
            }
        }// channelMessageReceived