/// <summary> /// On send message click, this will retrieve the data inputed by the user /// and attempt to send a message via MessageSender. User will be notified /// if the message was sent successfully or not. /// </summary> /// <param name="sender">The object that invoked the event</param> /// <param name="e">The event arguments</param> async void MSendMessage_Click(object sender, EventArgs e) { //Try to send a message to another user if (await MessageSender.SendSingleMessage(mMessage.Text, userSelected, MainActivity.credentials, URLs.serverURL + URLs.single_message)) { //Create a message object to store on the device Message m = new Message(); m.Date = System.DateTime.Now.ToString(); m.UserName = userSelected; m.MsgText = mMessage.Text; m.incoming = false; MessageRepository.SaveMessage(m); //Clear the input box mMessage.Text = ""; Toast.MakeText(this, "Message Sent!", ToastLength.Short).Show(); } else { Toast.MakeText(this, "Message Failed!", ToastLength.Short).Show(); } }
/// <summary> /// Static constructor, creates a single instance of the MessageRepository /// </summary> static MessageRepository() { me = new MessageRepository(); }
/// <summary> /// Static constructor, creates a single instance of the MessageRepository /// </summary> static MessageRepository() { me = new MessageRepository(); }