private void SendTypedNuntias() { string rawText = this.nuntiasTextBox.Text; BackgroundWorker loaderWorker = new BackgroundWorker(); Nuntias newNuntias = null; loaderWorker.DoWork += (s, e) => { try { string processedText = Universal.ProcessValidMessageText(rawText); if (processedText == null) { return; } if (this.TheConversation == null) { long?conversationId = ServerRequest.GetDuetConversationId(User.LoggedIn, this.receiver); if (conversationId == null) { MessageBox.Show("Server connection failed!\r\nPlease retry."); return; } this.TheConversation = new DuetConversation(Consumer.LoggedIn, this.receiver); this.TheConversation.ConversationID = (long)conversationId; } newNuntias = new Nuntias(processedText, User.LoggedIn.Id, Time.CurrentTime, this.theConversation.ConversationID); long?nuntiasTmpID = NuntiasRepository.Instance.StoreTmpNuntias(newNuntias); if (nuntiasTmpID == null) { return; } newNuntias.Id = nuntiasTmpID ?? 0; SyncAssets.NuntiasSortedList[(long)nuntiasTmpID] = newNuntias; this.Invoke(new Action(() => { this.nuntiasTextBox.Clear(); })); this.ShowNuntias(newNuntias, true); BackendManager.SendPendingNuntii(); } catch (Exception ex) { Console.WriteLine("Exception in SendTypedNuntias() => " + ex.Message); } }; loaderWorker.RunWorkerAsync(); loaderWorker.RunWorkerCompleted += (s, e) => { loaderWorker.Dispose(); }; if (ConversationListPanel.MyConversationListPanel != null) { ConversationListPanel.MyConversationListPanel.RefreshConversationList(); } }