/// <summary> /// Sends a request to the server through the /// AsyncClientEvent, in order to get all the messages in the chat /// </summary> private void getMessages() { Messager currentForm = this; var asyncClientEvent = new AsyncClientEvent { }; asyncClientEvent.StartClientWithChatForm("null", "null", "Get_Messages", "null", currentForm, "null"); }
/// <summary> /// Gets the message from the textbox, validates it; /// Sends a request through the AsyncClientEvent class to the server; /// </summary> private void materialRaisedButton1_Click(object sender, EventArgs e) { String userMessage = MessageTextBox.Text.Trim(); if (!String.IsNullOrEmpty(userMessage)) { MessageTextBox.Text = String.Empty; Messager currentForm = this; var asyncClientEvent = new AsyncClientEvent { }; asyncClientEvent.StartClientWithChatForm(currentUserName, "null", "Send_Message", userID, currentForm, userMessage); } else { MessageBox.Show("Please type in your message"); } }