예제 #1
0
        public bool SendMessage(object message)
        {
            if (message == null || !(message is BaseMessage))
            {
                return(false);
            }
            Type         messageType      = message.GetType();
            PropertyInfo serialNoProperty = messageType.GetProperty("SerialNo");

            if (serialNoProperty != null)
            {
                object SerialNo = serialNoProperty.GetValue(message);
                if (SerialNo == null || SerialNo.ToString() == string.Empty)
                {
                    serialNoProperty.SetValue(message, Guid.NewGuid().ToString("N"));
                }
            }

            PropertyInfo messageTypeProperty = messageType.GetProperty("MessageType");

            if (messageTypeProperty != null)
            {
                messageTypeProperty.SetValue(message, messageType.Name);
            }

            string strMessage = JsonExtension.ToJSON(message);

            byte[] data = Encoding.UTF8.GetBytes(strMessage);
            Send(data, 0, data.Length);
            OnSendMessage?.Invoke(strMessage);
            return(true);
        }
예제 #2
0
        private void SendFunc(object state)
        {
            //暂停定时器
            _sendTimer?.Change(
                Timeout.InfiniteTimeSpan,
                Timeout.InfiniteTimeSpan);

            if (_current == 0)
            {
                OnSendMessage?.Invoke(GetSendMessage(MqttClientConstants.Cmd.SendValueBegin));
            }

            //SendMessage
            OnSendMessage?.Invoke(GetSendMessage(_current));

            //校验是否发送完毕
            if (++_current >= _stop)
            {
                OnSendMessage?.Invoke(GetSendMessage(MqttClientConstants.Cmd.SendValueEnd));
                Stop();
                return;
            }

            //执行下次定时器
            _sendTimer?.Change(
                TimeSpan.FromMilliseconds(_interval),
                Timeout.InfiniteTimeSpan);
        }
예제 #3
0
    private void OnInputFieldSubmit(string message)
    {
        currentMessage.body        = message;
        currentMessage.sender      = UserProfile.GetOwnUserProfile().userId;
        currentMessage.messageType = ChatMessage.Type.NONE;
        currentMessage.recipient   = string.Empty;

        if (detectWhisper && !string.IsNullOrWhiteSpace(message))
        {
            whisperRegexMatch = whisperRegex.Match(message);

            if (whisperRegexMatch.Success)
            {
                currentMessage.messageType = ChatMessage.Type.PRIVATE;
                currentMessage.recipient   = whisperRegexMatch.Groups[2].Value;
                currentMessage.body        = whisperRegexMatch.Groups[4].Value;
            }
        }

        // A TMP_InputField is automatically marked as 'wasCanceled' when the ESC key is pressed
        if (inputField.wasCanceled)
        {
            currentMessage.body = string.Empty;
        }

        OnSendMessage?.Invoke(currentMessage);
    }
        void HandleOnSend()
        {
            string messageText = MessageInputField.text.Trim();

            OnSendMessage.Invoke(messageText);
            Reset();
        }
예제 #5
0
 void Start()
 {
     _sendMsg.onClick.RemoveAllListeners();
     _sendMsg.onClick.AddListener(() =>
     {
         OnSendMessage.Invoke(_input.text);
         _input.text = string.Empty;
     });
 }
        public void SendPeerMessage(string peerId, string text)
        {
            var rtmMessage = new AgoraRtmMessage(text);

            _rtmKit.SendMessage(rtmMessage, peerId, (state) =>
            {
                Console.WriteLine($"RTM send peer msg state: {state}");
                OnSendMessage?.Invoke(state == AgoraRtmSendPeerMessageErrorCode.Ok);
            });
        }
        public void SendChannelMessage(string text)
        {
            var rtmMessage = new AgoraRtmMessage(text);

            _rtmChannel.SendMessage(rtmMessage, (state) =>
            {
                Console.WriteLine($"RTM send channel msg state: {state}");
                OnSendMessage?.Invoke(state == AgoraRtmSendChannelMessageErrorCode.Ok);
            });
        }
예제 #8
0
 /// <summary>
 /// Raised when a new line was send.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">E.</param>
 private static void NewLineSent(object sender, CommandEventArgs e)
 {
                 #if DEBUG
     Console.WriteLine(DateTime.Now + @": Sent > " + e.Command.CommandString());
                 #endif
     if (OnSendMessage != null)
     {
         OnSendMessage.Invoke(null, new CommunicationArgs(e.Command.CommandString()));
     }
     LastCommunication = DateTime.Now;
 }
예제 #9
0
 public bool SendMessage(int connectID, object message)
 {
     if (message == null || !(message is BaseMessage))
     {
         return(false);
     }
     byte[] data = ConstructData(message);
     Send(connectID, data, 0, data.Length);
     OnSendMessage?.Invoke(GetClientIpById(connectID), GetClientPortIpById(connectID), connectID, $"{JsonExtension.ToJSON(message)}");
     return(true);
 }
예제 #10
0
 public bool SendMessage(string ip, object message)
 {
     if (message == null || !(message is BaseMessage))
     {
         return(false);
     }
     byte[] data = ConstructData(message);
     Send(ip, data, 0, data.Length);
     OnSendMessage?.Invoke(ip, 0, 0, $"{JsonExtension.ToJSON(message)}");
     return(true);
 }
예제 #11
0
        public void SendCommand(Command command)
        {
            if (command.Source != CommandSource.Client)
            {
                throw new ArgumentException($"{command.GetType().Name} Command source is invalid.", nameof(command));
            }

            lock (_Connection)
            {
                _Connection.Send(command.Serialize());
                OnSendMessage?.Invoke(this, new CommandEventArgs(command));
            }
        }
예제 #12
0
파일: Game2Proxy.cs 프로젝트: Alword/Bost
 public void Start()
 {
     Task.Run(() =>
     {
         while (true)
         {
             var buffer = new byte[8192];
             int size   = game.Receive(buffer);
             if (size > 0)
             {
                 var toSend = buffer[0..size];
                 OnSendMessage?.Invoke(this, toSend);
                 server.Send(toSend);
             }
예제 #13
0
        public void SendMessage(byte[] bytes, IPEndPoint endPoint)
        {
            lock (mSendQueue)
            {
                Logger.Log("SendMessage: " + bytes.Length + " endPoint: " + endPoint, EUDPBoxLogType.Log);

                mSendQueue.Enqueue(new QueueInfo()
                {
                    Content = bytes,
                    IPEndPointAddress_Str = endPoint.Address.ToString(),
                    IPEndPoint_Port       = endPoint.Port,
                });
            }
            OnSendMessage?.Invoke(bytes, endPoint);
        }
예제 #14
0
        public void JoinChannel(string channel)
        {
            Log($"Joining to channel [{channel}]");
            _channelListener = new AgoraRtmChannelListener();
            _channelListener.OnSignalReceived += (signal) =>
            {
                Log($"Signal received from {signal.RtcPeerId}");
                OnSignalReceived?.Invoke(signal);
            };
            _sendMessageChannelCallback = new ResultCallback();
            _sendMessageChannelCallback.OnSuccessAction += (obj) =>
            {
                Log("Send channel message Success");
                OnSendMessage?.Invoke(true);
            };
            _sendMessageChannelCallback.OnFailureAction += (obj) =>
            {
                Log("Send channel message Fail");
                OnSendMessage?.Invoke(false);
            };
            _rtmChannel = _rtmClient.CreateChannel(channel, _channelListener);
            var channelJoinCallBack = new ResultCallback();

            channelJoinCallBack.OnSuccessAction += (obj) =>
            {
                Log("Join Success");
                if (_rtmChannel == null)
                {
                    return;
                }
                OnJoinChannel?.Invoke(true);
            };
            channelJoinCallBack.OnFailureAction += (err) =>
            {
                Log($"Join Fail. {err.ErrorDescription}");
                if (_rtmChannel == null)
                {
                    return;
                }
                OnJoinChannel?.Invoke(false);
            };
            _rtmChannel?.Join(channelJoinCallBack);
        }
        public async Task SendTextMessage(Peer peer, int receiverId, string msg)
        {
            TlAbsInputPeer receiver = await GetInputPeer(peer, receiverId);

            var update = await _client.SendMessageAsync(receiver, msg);

            Message message = null;

            if (update is TlUpdateShortSentMessage)
            {
                message = _ioc.Resolve <Message>();
                message.FillValues("You", msg, (update as TlUpdateShortSentMessage).TimeUnixToWindows(true));
            }
            else
            {
                message = GetMessage(update);
            }
            OnSendMessage?.Invoke(message);
        }
예제 #16
0
        public async Task <bool> SendCommandAsync(Command command)
        {
            if (command.Source != CommandSource.Client)
            {
                throw new ArgumentException("Command source is invalid.", nameof(command));
            }

            bool result = false;
            var  ev     = new AsyncAutoResetEvent();

            _Connection.SendAsync(command.Serialize(), (r) => {
                result = r;
                ev.Set();
            });
            OnSendMessage?.Invoke(this, new CommandEventArgs(command));

            await ev.WaitAsync();

            return(result);
        }
예제 #17
0
        public bool SendMessage <T>(object message) where T : BaseMessage
        {
            if (message == null || !(message is BaseMessage))
            {
                return(false);
            }
            Type   messageType = message.GetType();
            object SerialNo    = messageType.GetProperty("SerialNo").GetValue(message);

            if (SerialNo == null || SerialNo.ToString() == string.Empty)
            {
                messageType.GetProperty("SerialNo").SetValue(message, Guid.NewGuid().ToString("N"));
            }
            messageType.GetProperty("MessageType").SetValue(message, typeof(T).Name);
            string strMessage = JsonExtension.ToJSON(message);

            byte[] data = Encoding.UTF8.GetBytes(strMessage);
            Send(data, 0, data.Length);
            OnSendMessage?.Invoke(strMessage);
            return(true);
        }
        public async Task SendFile(Peer peer, int receiverId, string path, string caption)
        {
            var receiver = await GetInputPeer(peer, receiverId);

            path = path.Trim('"');
            var str = path.Split('\\');

            using (var stream = new FileStream(path, FileMode.Open))
            {
                //var fileResult = await _client.UploadFile(str[str.Length - 1], new StreamReader(stream));
                //await _client.SendUploadedPhoto(reciever, fileResult, caption);
                var fileResult = await _client.UploadFile(str[str.Length - 1], new StreamReader(stream));

                var attr     = new TlVector <TlAbsDocumentAttribute>();
                var filename = new TlDocumentAttributeFilename {
                    FileName = str[str.Length - 1]
                };
                attr.Lists.Add(filename);
                var update = await _client.SendUploadedDocument(receiver, fileResult, caption, String.Empty, attr);

                OnSendMessage?.Invoke(GetMessage(update));
            }
        }
예제 #19
0
 public void SendMessage <T>(int connectID, object message) where T : BaseMessage
 {
     byte[] data = ConstructData <T>(message);
     Send(connectID, data, 0, data.Length);
     OnSendMessage?.Invoke(GetClientIpById(connectID), GetClientPortIpById(connectID), connectID, $"{JsonExtension.ToJSON(message)}");
 }
예제 #20
0
 public void SendMessageToAll(object message)
 {
     byte[] data = ConstructData(message);
     SendToAllClient(data, 0, data.Length);
     OnSendMessage?.Invoke("0", 0, 0, $"{JsonExtension.ToJSON(message)}");
 }
 public void OnClick_SendMessage()
 {
     OnSendMessage?.Invoke(m_cTbxMessage.text);
     m_cTbxMessage.text = "";
 }
예제 #22
0
        //This is where update code goes, aka dispatching delegates
        public void Update()
        {
            Operation operation = GetNextOperation();

            if (operation == null)
            {
                return;
            }

#if DEBUG
            Console.WriteLine("Operation recieved.");
            Console.WriteLine(">>Type: " + operation.Type);
            Console.WriteLine(">>Oprev: " + operation.Revision);
            Console.WriteLine(">>Param1: " + operation.Param1);
            Console.WriteLine(">>Param2: " + operation.Param2);
            Console.WriteLine(">>Param3: " + operation.Param3);
            if (operation.Message != null)
            {
                Console.WriteLine(">>Message: ");
                Console.WriteLine(">>>Text: " + operation.Message.Text);
                if (operation.Message.ContentMetadata != null)
                {
                    Console.WriteLine(">>>Content-Metadata:");
                    foreach (KeyValuePair <string, string> kvp in operation.Message.ContentMetadata)
                    {
                        Console.WriteLine(">>>>Key = {0}, Value = {1}",
                                          kvp.Key, kvp.Value);
                    }
                }
                Console.WriteLine(">>>>CreatedTime: " + operation.Message.CreatedTime);
                Console.WriteLine(">>>>DeliveredTime: " + operation.Message.DeliveredTime);
                Console.WriteLine(">>>ID: " + operation.Message.Id);
                Console.WriteLine(">>>To: " + operation.Message.To);
                Console.WriteLine(">>>From: " + operation.Message.From);
                Console.WriteLine(">>>Type: " + operation.Message.ContentType);
            }



            Console.WriteLine();
#endif

            switch (operation.Type)
            {
            case OpType.END_OF_OPERATION:
                //if (OnEndofOperation != null) OnEndofOperation.Invoke(this, new EndofOperationEventArgs());
                break;

            case OpType.UPDATE_PROFILE:
                if (OnUpdateProfile != null)
                {
                    OnUpdateProfile.Invoke(this, new UpdateProfileEventArgs());
                }
                break;

            case OpType.NOTIFIED_UPDATE_PROFILE:
                if (OnNotifiedUpdateProfile != null)
                {
                    OnNotifiedUpdateProfile.Invoke(this, new NotifiedUpdateProfileEventArgs(operation.Param1));
                }
                break;

            case OpType.REGISTER_USERID:
                if (OnRegisterUserid != null)
                {
                    OnRegisterUserid.Invoke(this, new RegisterUseridEventArgs());
                }
                break;

            case OpType.ADD_CONTACT:
                if (OnAddContact != null)
                {
                    OnAddContact.Invoke(this, new UserMidArgs(operation.Param1));
                }
                break;

            case OpType.NOTIFIED_ADD_CONTACT:
                if (OnNotifiedAddContact != null)
                {
                    OnNotifiedAddContact.Invoke(this, new UserMidArgs(operation.Param1));
                }
                break;

            case OpType.BLOCK_CONTACT:
                if (OnBlockContact != null)
                {
                    OnBlockContact.Invoke(this, new UserMidArgs(operation.Param1));
                }
                break;

            case OpType.UNBLOCK_CONTACT:
                if (OnUnblockContact != null)
                {
                    OnUnblockContact.Invoke(this, new UserMidArgs(operation.Param1));
                }
                break;

            case OpType.NOTIFIED_RECOMMEND_CONTACT:
                if (OnNotifiedRecommendContact != null)
                {
                    OnNotifiedRecommendContact.Invoke(this, new NotifiedRecommendContactEventArgs());
                }
                break;

            case OpType.CREATE_GROUP:
                if (OnCreateGroup != null)
                {
                    OnCreateGroup.Invoke(this, new CreateGroupEventArgs());
                }
                break;

            case OpType.UPDATE_GROUP:
                if (OnUpdateGroup != null)
                {
                    OnUpdateGroup.Invoke(this, new UserMidArgs(operation.Param1));
                }
                break;

            case OpType.NOTIFIED_UPDATE_GROUP:
                if (OnNotifiedUpdateGroup != null)
                {
                    OnNotifiedUpdateGroup.Invoke(this, new ItemUserMidArgs(operation.Param1, operation.Param2));
                }
                break;

            case OpType.INVITE_INTO_GROUP:
                if (OnInviteintoGroup != null)
                {
                    OnInviteintoGroup.Invoke(this, new InviteintoGroupEventArgs(operation.Param1, operation.Param2));
                }
                break;

            case OpType.NOTIFIED_INVITE_INTO_GROUP:
                if (OnNotifiedInviteintoGroup != null)
                {
                    OnNotifiedInviteintoGroup.Invoke(this, new NotifiedInviteintoGroupEventArgs());
                }
                break;

            case OpType.LEAVE_GROUP:
                if (OnLeaveGroup != null)
                {
                    OnLeaveGroup.Invoke(this, new LeaveGroupEventArgs());
                }
                break;

            case OpType.NOTIFIED_LEAVE_GROUP:
                if (OnNotifiedLeaveGroup != null)
                {
                    OnNotifiedLeaveGroup.Invoke(this, new NotifiedLeaveGroupEventArgs());
                }
                break;

            case OpType.ACCEPT_GROUP_INVITATION:
                if (OnAcceptGroupInvitation != null)
                {
                    OnAcceptGroupInvitation.Invoke(this, new AcceptGroupInvitationEventArgs());
                }
                break;

            case OpType.NOTIFIED_ACCEPT_GROUP_INVITATION:
                if (OnNotifiedAcceptGroupInvitation != null)
                {
                    OnNotifiedAcceptGroupInvitation.Invoke(this, new NotifiedAcceptGroupInvitationEventArgs());
                }
                break;

            case OpType.KICKOUT_FROM_GROUP:
                if (OnKickoutfromGroup != null)
                {
                    OnKickoutfromGroup.Invoke(this, new KickoutfromGroupEventArgs());
                }
                break;

            case OpType.NOTIFIED_KICKOUT_FROM_GROUP:
                if (OnNotifiedKickoutfromGroup != null)
                {
                    OnNotifiedKickoutfromGroup.Invoke(this, new NotifiedKickoutfromGroupEventArgs());
                }
                break;

            case OpType.CREATE_ROOM:
                if (OnCreateRoom != null)
                {
                    OnCreateRoom.Invoke(this, new CreateRoomEventArgs());
                }
                break;

            case OpType.INVITE_INTO_ROOM:
                if (OnInviteintoRoom != null)
                {
                    OnInviteintoRoom.Invoke(this, new InviteintoRoomEventArgs());
                }
                break;

            case OpType.NOTIFIED_INVITE_INTO_ROOM:
                if (OnNotifiedInviteintoRoom != null)
                {
                    OnNotifiedInviteintoRoom.Invoke(this, new NotifiedInviteintoRoomEventArgs());
                }
                break;

            case OpType.LEAVE_ROOM:
                if (OnLeaveRoom != null)
                {
                    OnLeaveRoom.Invoke(this, new LeaveRoomEventArgs());
                }
                break;

            case OpType.NOTIFIED_LEAVE_ROOM:
                if (OnNotifiedLeaveRoom != null)
                {
                    OnNotifiedLeaveRoom.Invoke(this, new NotifiedLeaveRoomEventArgs());
                }
                break;

            case OpType.SEND_MESSAGE:
                if (OnSendMessage != null)
                {
                    OnSendMessage.Invoke(this, new SendMessageEventArgs());
                }
                break;

            case OpType.RECEIVE_MESSAGE:
                if (OnReceiveMessage != null)
                {
                    OnReceiveMessage.Invoke(this, new ReceiveMessageEventArgs(operation.Message));
                }
                break;

            case OpType.SEND_MESSAGE_RECEIPT:
                if (OnSendMessageReceipt != null)
                {
                    OnSendMessageReceipt.Invoke(this, new SendMessageReceiptEventArgs());
                }
                break;

            case OpType.RECEIVE_MESSAGE_RECEIPT:
                if (OnReceiveMessageReceipt != null)
                {
                    OnReceiveMessageReceipt.Invoke(this, new ReceiveMessageReceiptEventArgs());
                }
                break;

            case OpType.SEND_CONTENT_RECEIPT:
                if (OnSendContentReceipt != null)
                {
                    OnSendContentReceipt.Invoke(this, new SendContentReceiptEventArgs());
                }
                break;

            case OpType.RECEIVE_ANNOUNCEMENT:
                if (OnReceiveAnnouncement != null)
                {
                    OnReceiveAnnouncement.Invoke(this, new ReceiveAnnouncementEventArgs());
                }
                break;

            case OpType.CANCEL_INVITATION_GROUP:
                if (OnCancelInvitationGroup != null)
                {
                    OnCancelInvitationGroup.Invoke(this, new CancelInvitationGroupEventArgs());
                }
                break;

            case OpType.NOTIFIED_CANCEL_INVITATION_GROUP:
                if (OnNotifiedCancelInvitationGroup != null)
                {
                    OnNotifiedCancelInvitationGroup.Invoke(this, new NotifiedCancelInvitationGroupEventArgs());
                }
                break;

            case OpType.NOTIFIED_UNREGISTER_USER:
                if (OnNotifiedUnregisterUser != null)
                {
                    OnNotifiedUnregisterUser.Invoke(this, new NotifiedUnregisterUserEventArgs());
                }
                break;

            case OpType.REJECT_GROUP_INVITATION:
                if (OnRejectGroupInvitation != null)
                {
                    OnRejectGroupInvitation.Invoke(this, new RejectGroupInvitationEventArgs());
                }
                break;

            case OpType.NOTIFIED_REJECT_GROUP_INVITATION:
                if (OnNotifiedRejectGroupInvitation != null)
                {
                    OnNotifiedRejectGroupInvitation.Invoke(this, new NotifiedRejectGroupInvitationEventArgs());
                }
                break;

            case OpType.UPDATE_SETTINGS:
                if (OnUpdateSettings != null)
                {
                    OnUpdateSettings.Invoke(this, new UpdateSettingsEventArgs());
                }
                break;

            case OpType.NOTIFIED_REGISTER_USER:
                if (OnNotifiedRegisterUser != null)
                {
                    OnNotifiedRegisterUser.Invoke(this, new NotifiedRegisterUserEventArgs());
                }
                break;

            case OpType.INVITE_VIA_EMAIL:
                if (OnInviteviaEmail != null)
                {
                    OnInviteviaEmail.Invoke(this, new InviteviaEmailEventArgs());
                }
                break;

            case OpType.NOTIFIED_REQUEST_RECOVERY:
                if (OnNotifiedRequestRecovery != null)
                {
                    OnNotifiedRequestRecovery.Invoke(this, new NotifiedRequestRecoveryEventArgs());
                }
                break;

            case OpType.SEND_CHAT_CHECKED:
                if (OnSendChatChecked != null)
                {
                    OnSendChatChecked.Invoke(this, new SendChatCheckedEventArgs());
                }
                break;

            case OpType.SEND_CHAT_REMOVED:
                if (OnSendChatRemoved != null)
                {
                    OnSendChatRemoved.Invoke(this, new SendChatRemovedEventArgs());
                }
                break;

            case OpType.NOTIFIED_FORCE_SYNC:
                if (OnNotifiedForceSync != null)
                {
                    OnNotifiedForceSync.Invoke(this, new NotifiedForceSyncEventArgs());
                }
                break;

            case OpType.SEND_CONTENT:
                if (OnSendContent != null)
                {
                    OnSendContent.Invoke(this, new SendContentEventArgs());
                }
                break;

            case OpType.SEND_MESSAGE_MYHOME:
                if (OnSendMessageMyhome != null)
                {
                    OnSendMessageMyhome.Invoke(this, new SendMessageMyhomeEventArgs());
                }
                break;

            case OpType.NOTIFIED_UPDATE_CONTENT_PREVIEW:
                if (OnNotifiedUpdateContentPreview != null)
                {
                    OnNotifiedUpdateContentPreview.Invoke(this, new NotifiedUpdateContentPreviewEventArgs());
                }
                break;

            case OpType.REMOVE_ALL_MESSAGES:
                if (OnRemoveAllMessages != null)
                {
                    OnRemoveAllMessages.Invoke(this, new RemoveAllMessagesEventArgs());
                }
                break;

            case OpType.NOTIFIED_UPDATE_PURCHASES:
                if (OnNotifiedUpdatePurchases != null)
                {
                    OnNotifiedUpdatePurchases.Invoke(this, new NotifiedUpdatePurchasesEventArgs());
                }
                break;

            case OpType.DUMMY:
                if (OnDummy != null)
                {
                    OnDummy.Invoke(this, new DummyEventArgs());
                }
                break;

            case OpType.UPDATE_CONTACT:
                if (OnUpdateContact != null)
                {
                    OnUpdateContact.Invoke(this, new UpdateContactEventArgs());
                }
                break;

            case OpType.NOTIFIED_RECEIVED_CALL:
                if (OnNotifiedReceivedCall != null)
                {
                    OnNotifiedReceivedCall.Invoke(this, new NotifiedReceivedCallEventArgs());
                }
                break;

            case OpType.CANCEL_CALL:
                if (OnCancelCall != null)
                {
                    OnCancelCall.Invoke(this, new CancelCallEventArgs());
                }
                break;

            case OpType.NOTIFIED_REDIRECT:
                if (OnNotifiedRedirect != null)
                {
                    OnNotifiedRedirect.Invoke(this, new NotifiedRedirectEventArgs());
                }
                break;

            case OpType.NOTIFIED_CHANNEL_SYNC:
                if (OnNotifiedChannelSync != null)
                {
                    OnNotifiedChannelSync.Invoke(this, new NotifiedChannelSyncEventArgs());
                }
                break;

            case OpType.FAILED_SEND_MESSAGE:
                if (OnFailedSendMessage != null)
                {
                    OnFailedSendMessage.Invoke(this, new FailedSendMessageEventArgs());
                }
                break;

            case OpType.NOTIFIED_READ_MESSAGE:
                if (OnNotifiedReadMessage != null)
                {
                    OnNotifiedReadMessage.Invoke(this, new NotifiedReadMessageEventArgs());
                }
                break;

            case OpType.FAILED_EMAIL_CONFIRMATION:
                if (OnFailedEmailConfirmation != null)
                {
                    OnFailedEmailConfirmation.Invoke(this, new FailedEmailConfirmationEventArgs());
                }
                break;

            case OpType.NOTIFIED_CHAT_CONTENT:
                if (OnNotifiedChatContent != null)
                {
                    OnNotifiedChatContent.Invoke(this, new NotifiedChatContentEventArgs());
                }
                break;

            case OpType.NOTIFIED_PUSH_NOTICENTER_ITEM:
                if (OnNotifiedPushNoticenterItem != null)
                {
                    OnNotifiedPushNoticenterItem.Invoke(this, new NotifiedPushNoticenterItemEventArgs());
                }
                break;

            default:
                break;
            }
        }
예제 #23
0
 /// <summary>
 /// Send message
 /// </summary>
 /// <param name="obj">object</param>
 protected virtual void OnSendMessageHadle(T obj)
 {
     //Invoke event
     OnSendMessage?.Invoke(obj);
 }
 public void OnDoneButtonPress(string text)
 {
     OnSendMessage.Invoke(text.Trim());
     Reset();
 }
예제 #25
0
 public void Send(Envelope envelope)
 {
     OutboundQueue.Enqueue(envelope);
     OnSendMessage?.Invoke(envelope);
 }