public void HandleMessage(byte[] message, Socket socket, NetworkStream stream) { IMessage decodedMessage; switch ((MessageIds)message[0]) { case MessageIds.Heartbeat: decodedMessage = new HeartbeatMessage(); decodedMessage.Unpack(message); TakeAction((HeartbeatMessage)decodedMessage, socket); break; case MessageIds.JoinChatroom: decodedMessage = new JoinChatroomMessage(); decodedMessage.Unpack(message); TakeAction((JoinChatroomMessage)decodedMessage, socket, stream); break; case MessageIds.SendChat: decodedMessage = new SendChatMessage(); decodedMessage.Unpack(message); TakeAction((SendChatMessage)decodedMessage); break; default: break; } }
public PublicChat(int p_chat_id, List <string> p_chat_persons, SendChatMessage p_send_message , RemoveChatFormManager p_remove, StartLeaveChatRequest p_start_leave_chat_request) { InitializeComponent(); base.BaseConstruct(p_chat_id, TypeOfChat.Public, p_chat_persons, p_send_message, p_remove , p_start_leave_chat_request, ChatPersons_list, MessagesList_TextBox); }
public AllChats(SendChatMessage p_send_message, StartLeaveChatRequest p_start_leave_chat_request) { send_message = p_send_message; start_leave_chat_request = p_start_leave_chat_request; public_chat_manager = new Ma_PublicChatManager(new SendChatMessage(AllCh_SendChatMessage), new StartLeaveChatRequest(AllCh_StartLeaveChatRequest)); private_chat_manager = new Ma_PrivateChatManager(new SendChatMessage(AllCh_SendChatMessage), new StartLeaveChatRequest(AllCh_StartLeaveChatRequest)); }
public async Task SendChatMessage([FromBody] SendChatMessage chatMessage) { if (chatMessage == null) { throw new HttpResponseException(HttpStatusCode.BadRequest); } await ChannelSession.Chat.SendMessage(chatMessage.Message, chatMessage.SendAsStreamer); }
private void TakeAction(SendChatMessage message) { var newChat = new Chat() { Username = message.Username, Message = message.Message }; _chatQueue.Enqueue(newChat); }
public static async Task SendMessageAsync(string message, bool sendAsStreamer) { var model = new SendChatMessage { Message = message, SendAsStreamer = sendAsStreamer }; await RestClient.PostAsync("chat/message", model); }
private void SendChat() { var newMessage = new SendChatMessage() { Message = Text, Username = _informationHolding.Username }; _queueService.Enqueue(newMessage); Text = ""; }
public async Task SendMessageAsync(SendChatMessage message) { State.Participants ??= new HashSet <Guid>(); State.Participants.Add(message.SenderUserId); var messageIndex = State.MessageCount + 1; var messageGrain = GrainFactory.GetGrain <IChatMessageGrain>(messageIndex, this.GetPrimaryKeyString()); await messageGrain.UpdateMessageDetailsAsync(message, messageIndex); State.MessageCount++; Dirty = true; }
public PrivateChat(int p_chat_id, string p_own_user_name, SendChatMessage p_send_message, RemoveChatFormManager p_remove , StartLeaveChatRequest p_start_leave_chat_request) { InitializeComponent(); List <string> temp_users_list = new List <string>(); temp_users_list.Add(p_own_user_name); base.BaseConstruct(p_chat_id, TypeOfChat.Private, temp_users_list, p_send_message, p_remove, p_start_leave_chat_request, ChatPersons_list , MessagesList_TextBox); }
private void SendMessage() { if (characterName == null) { characterName = GetCharacterName(); } var message = $"{characterName}: {inputField.text}"; SendChatMessage?.Invoke(message); AddMessage(message); }
public async Task SendChatMessage([FromBody] SendChatMessage chatMessage) { if (chatMessage == null) { var resp = new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new ObjectContent <Error>(new Error { Message = "Unable to parse chat message from POST body." }, new JsonMediaTypeFormatter(), "application/json"), ReasonPhrase = "Invalid POST Body" }; throw new HttpResponseException(resp); } await ChannelSession.Chat.SendMessage(chatMessage.Message, chatMessage.SendAsStreamer); }
private void GetMessageFromClient(Connection con, SendChatMessage cmd) { if (con.ConnectionId > 0) { var key = $"txtChat{con.ConnectionId}"; string msg = (string)cmd.GetData()[0]; this.Invoke(new Action(() => { var txt = con.TabPage.Controls.Find(key, false).FirstOrDefault(); if (txt != null) { txt.Text += $"{DateTime.Now.ToString()} {con.ClientIP}: \n{msg} \n\n"; } })); } }
protected void BaseConstruct(int p_chat_id, TypeOfChat p_chat_type, List <string> p_chat_persons, SendChatMessage p_send_message , RemoveChatFormManager p_remove, StartLeaveChatRequest p_start_leave_chat_request, ListBox p_chat_persons_list_box , RichTextBox p_message_list_text_box) { chat_id = p_chat_id; chat_type = p_chat_type; chat_persons = p_chat_persons; send_message = p_send_message; start_leave_chat_request = p_start_leave_chat_request; remove = p_remove; chat_persons_list_box = p_chat_persons_list_box; messages_list_text_box = p_message_list_text_box; close_flag = false; chat_persons_list_box.Items.Clear(); foreach (string t_user_name in p_chat_persons) { chat_persons_list_box.Items.Add(t_user_name); } this.Show(); }
public Ma_PublicChatManager(SendChatMessage p_send_message, StartLeaveChatRequest p_start_leave_chat_request) { base.BaseConstruct(TypeOfChat.Public, p_send_message, p_start_leave_chat_request); all_chats = new Dictionary <int, PublicChat>(); }
public void BaseConstruct(TypeOfChat p_chat_type, SendChatMessage p_send_message, StartLeaveChatRequest p_start_leave_chat_request) { chat_type = p_chat_type; send_message = p_send_message; start_leave_chat_request = p_start_leave_chat_request; }
private bool onSendChatMessage(SendChatMessage evt) { Service.Get <INetworkServicesManager>().ChatService.SendMessage(evt.Message, (!(evt.SizzleClip == null)) ? evt.SizzleClip.Id : 0, evt.Quest.QuestId, evt.Quest.Objective); return(false); }