// Prepares the chat item to be sent to the cloud private void SendChatLine() { string msg = TextInput.Text.Trim(); if (isLoggedin && msg.Length > 0) { DateTimeOffset myDTO = (DateTimeOffset)GetCurrentTime(); DateTime utc = myDTO.UtcDateTime; var chatItem = new ChatItem { Text = msg, UserName = String.Format("{0}", userUniqueID), TimeStamp = utc }; //lastChatline = chatItem.Text; InsertChatItem(chatItem); TextInput.Text = ""; //RefreshChatItems(); } }
// Inserts a new chat item to the conversation by posting it in the Azure Mobile // Services table, and posting it in the application's chat window private async void InsertChatItem(ChatItem chatItem) { // This code inserts a new ChatItem into the database await chatTable.InsertAsync(chatItem); }