public async void ChatMessageReceived(ChatMessage message) { string formattedMessage = String.Format("{0}: {1}", message.Sender, message.Message); var mainPageViewModel = MainPageViewModel.GetInstance(); await App.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { mainPageViewModel.ChatMessages.Add(formattedMessage); }); }
public async void InitiateMessageSend(string message) { var serverProxy = ServerProxy.GetInstance(); var chat = new ChatMessage {Message = message, Sender = Settings.Alias}; if (serverProxy.messageSender != null) { await serverProxy.messageSender.SendMessage(PacketType.c_Chat, chat); } }