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();
        }
        public static void DefineServerToClientMethods()
        {
            ServerHub.WorkingInstance.ServerHubProxy.On <JObject>("SendNuntias", (nuntiasJson) =>
            {
                Nuntias newNuntias = new Nuntias(nuntiasJson);
                if (newNuntias != null)
                {
                    Console.WriteLine("SendNuntias() Called by server => " + newNuntias.Id + " " + newNuntias.ContentFileId);
                    bool updatedNuntias = false;
                    if (newNuntias.SenderId != Consumer.LoggedIn.Id && newNuntias.DeliveryTime == null)
                    {
                        newNuntias.DeliveryTime = Time.CurrentTime;
                        updatedNuntias          = true;
                    }
                    if (newNuntias.ContentFileId != null && newNuntias.ContentFileId.Length > 0)
                    {
                        if (newNuntias.ContentFileId == "deleted")
                        {
                            try
                            {
                                LocalDataFileAccess.EraseContentFile(SyncAssets.NuntiasSortedList[newNuntias.Id].ContentFileId);
                            }
                            catch { }
                        }
                        else
                        {
                            ServerFileRequest.DownloadAndStoreContentFile(newNuntias);
                        }
                    }
                    bool?updateResult = NuntiasRepository.Instance.Update(newNuntias);
                    if (updateResult == false)
                    {
                        long?result = NuntiasRepository.Instance.Insert(newNuntias);
                        if (result == null)
                        {
                            return;
                        }
                        try
                        {
                            if (ConversationListPanel.MyConversationListPanel != null)
                            {
                                ConversationListPanel.MyConversationListPanel.RefreshConversationList();
                            }
                            if (ConversationPanel.CurrentDisplayedConversationPanel.TheConversation.ConversationID == newNuntias.NativeConversationID)
                            {
                                ConversationPanel.CurrentDisplayedConversationPanel.ShowNuntias(newNuntias, true);
                            }
                        }
                        catch { }
                    }
                    else if (updateResult == true)
                    {
                        SyncAssets.UpdateNuntias(newNuntias);
                    }
                    if (updatedNuntias)
                    {
                        ServerRequest.UpdateNuntiasStatus(newNuntias);
                    }
                }
            }
                                                                  );

            ServerHub.WorkingInstance.ServerHubProxy.On("SendPendingNuntias", () =>
            {
                Console.WriteLine("SendPendingNuntias() Called by server. ");
                BackendManager.SendPendingNuntii();
            }
                                                        );

            ServerHub.WorkingInstance.ServerHubProxy.On <long, string>("UpdateUsersActivity", (userId, userActivity) =>
            {
                try
                {
                    if (ConversationPanel.CurrentDisplayedConversationPanel.TheConversation.Type == "duet" && ((DuetConversation)ConversationPanel.CurrentDisplayedConversationPanel.TheConversation).OtherMember.Id == userId)
                    {
                        ConversationPanel.CurrentDisplayedConversationPanel.UpdateUserActivity(userActivity);
                    }
                }
                catch { }
            }
                                                                       );

            ServerHub.WorkingInstance.ServerHubProxy.On <long, string>("SomethingBeingTypedForYou", (conversationId, messageText) =>
            {
                try
                {
                    if (ConversationPanel.CurrentDisplayedConversationPanel.TheConversation.ConversationID == conversationId)
                    {
                        if (Universal.ParentForm.InvokeRequired)
                        {
                            Universal.ParentForm.Invoke(new Action(() =>
                            {
                                ConversationPanel.CurrentDisplayedConversationPanel.SomethingBeingTypedLabel.Text = messageText;
                                ConversationPanel.CurrentDisplayedConversationPanel.AdjustTypingBarSize();
                            }));
                        }

                        else
                        {
                            ConversationPanel.CurrentDisplayedConversationPanel.SomethingBeingTypedLabel.Text = messageText;
                            ConversationPanel.CurrentDisplayedConversationPanel.AdjustTypingBarSize();
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception in SomethingBeingTypedForYou() => : " + ex.Message);
                }
            }
                                                                       );
        }