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();
            }
        }
        private void LoadPerviousNuntiasList()
        {
            VisualizingTools.ShowWaitingAnimation(new Point(this.Width / 4, this.conversationTitleBar.Bottom + 30), new Size(this.Width / 2, 10), this);
            BackgroundWorker loaderWorker = new BackgroundWorker();

            loaderWorker.DoWork += (s, e) =>
            {
                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;
                }

                List <Nuntias> previousNuntii        = ConversationRepository.Instance.GetLastNuntias(this.theConversation);
                List <Nuntias> previousPendingNuntii = ConversationRepository.Instance.GetPendingNuntii(this.theConversation);
                previousNuntii.AddRange(previousPendingNuntii);

                if (previousNuntii != null && previousNuntii.Count > 0)
                {
                    foreach (Nuntias item in previousNuntii)
                    {
                        SyncAssets.NuntiasSortedList[item.Id] = item;
                        if (item.Id > 0)
                        {
                            ServerFileRequest.DownloadAndStoreContentFile(item);
                        }
                        this.ShowNuntias(item, false);
                    }
                }
                this.ConversationPanelLoadingOk = true;
            };
            loaderWorker.RunWorkerCompleted += (s, e) => { VisualizingTools.HideWaitingAnimation(); loaderWorker.Dispose(); };
            loaderWorker.RunWorkerAsync();
        }
        private void SendChoosenFile(string choosenSafeFileName, string localPath, string extension)
        {
            if (File.ReadAllBytes(localPath).Length > 1024 * 1024 * 5)
            {
                Universal.ShowErrorMessage("Please choose a file below 5 MB.");
                return;
            }
            this.sendFileButton.Visible   = false;
            this.cancelFileButton.Visible = false;
            int animationLeft = 0, animationPadding = 40;

            if (imgPreview != null)
            {
                animationLeft = imgPreview.Right + animationPadding;
            }
            else
            {
                animationLeft = Math.Max(animationLeft, fileNameLabel.Right + animationPadding);
            }
            VisualizingTools.ShowWaitingAnimation(new Point(animationLeft, (filePreviewPanel.Height - sendButton.Height / 2) / 2), new Size(this.filePreviewPanel.Right - animationLeft - animationPadding - 20, sendButton.Height / 2), filePreviewPanel);
            BackgroundWorker loaderWorker = new BackgroundWorker();

            loaderWorker.DoWork += (s, e) =>
            {
                try
                {
                    using (FileStream gotFileStream = new FileStream(localPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    {
                        string       fileIdName          = this.theConversation.ConversationID + "_" + Universal.SystemMACAddress + "_" + Time.CurrentTime.TimeStampString + "-" + choosenSafeFileName;
                        MemoryStream gotFileMemoryStream = new MemoryStream();
                        gotFileStream.CopyTo(gotFileMemoryStream);
                        bool storeToLocalSucceed = LocalDataFileAccess.SaveNuntiasContentToLocal(gotFileMemoryStream, fileIdName);
                        if (storeToLocalSucceed)
                        {
                            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;
                            }
                            Nuntias newNuntias = new Nuntias("File: " + choosenSafeFileName, Consumer.LoggedIn.Id, Time.CurrentTime, this.theConversation.ConversationID);
                            newNuntias.ContentFileId = fileIdName;
                            if (extension == ".jpg" || extension == ".jpeg" || extension == ".png" || extension == ".gif" || extension == ".bmp")
                            {
                                newNuntias.Text = "Image : " + choosenSafeFileName;
                            }
                            long?nuntiasTmpID = NuntiasRepository.Instance.StoreTmpNuntias(newNuntias);
                            if (nuntiasTmpID == null)
                            {
                                newNuntias = null;
                            }
                            else
                            {
                                newNuntias.Id = nuntiasTmpID ?? 0;
                            }
                            if (newNuntias == null)
                            {
                                return;
                            }

                            this.ShowNuntias(newNuntias, true);
                            BackendManager.SendPendingNuntii();

                            string localStoredPath = LocalDataFileAccess.GetContentPathFromLocalData(fileIdName);

                            Universal.ParentForm.Invoke(new Action(() =>
                            {
                                VisualizingTools.HideWaitingAnimation();
                                if (localStoredPath != null)
                                {
                                    this.FilePreviewPanelHeight(0);
                                }
                                else
                                {
                                    Universal.ShowErrorMessage("Failed to send the file!");
                                }
                            }));

                            gotFileStream.Close();
                            gotFileMemoryStream.Dispose();
                            loaderWorker.Dispose();
                            this.DisposeUnmanaged();
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error occured while sending a file: " + ex.Message);
                };
            };
            loaderWorker.RunWorkerAsync();
            loaderWorker.RunWorkerCompleted += (s, e) => { loaderWorker.Dispose(); };
            if (ConversationListPanel.MyConversationListPanel != null)
            {
                ConversationListPanel.MyConversationListPanel.RefreshConversationList();
            }
        }