Example #1
0
        public override void RemoveChat(ChatModel chat)
        {
            ChatView chatView = GetChat(chat);

            if (chatView == null)
            {
 #if LOG4NET
                f_Logger.Warn("RemoveChat(): chatView is null!");
#endif
                return;
            }

            f_Notebook.RemovePage(f_Notebook.PageNum(chatView));
            TreeView.Remove(chatView);
            f_Chats.Remove(chatView);
            SyncManager.Remove(chat);
            SyncedChats.Remove(chatView);

            if (ChatRemoved != null)
            {
                ChatRemoved(this, new ChatViewManagerChatRemovedEventArgs(chatView));
            }

            chatView.Dispose();
        }
Example #2
0
        public void Clear()
        {
            Trace.Call();

            f_Config = null;
            f_Chats.Clear();
            f_Notebook.RemoveAllPages();
            SyncedChats.Clear();
            SyncManager.Clear();
        }
Example #3
0
        void OnChatSynced(object sender, ChatViewSyncedEventArgs e)
        {
            Trace.Call(sender, e);

            // FIXME: should we tell the FrontendManager before we sync?
            // no problem making remoting calls here as this event is called
            // from worker threads
            // REMOTING CALL 1
            Frontend.FrontendManager.AddSyncedChat(e.ChatView.ChatModel);

            GLib.Idle.Add(delegate {
                var chatView = (ChatView)e.ChatView;

                // we need to bailt out in case the chat was closed during the sync
                // else chatView.Populate() will die hard, see #635
                if (!Chats.Contains(chatView))
                {
#if LOG4NET
                    f_Logger.Debug("OnChatSynced(): detected closed chat: " +
                                   chatView.ID + " during sync, bailing out...");
#endif
                    return(false);
                }

                // HACK: patch chat position as OnChatAdded is not honoring the
                // AddChat order nor the complete range of chats
                if (chatView.Position != -1)
                {
                    f_Notebook.ReorderChild(chatView, chatView.Position);
                }

#if LOG4NET
                DateTime start = DateTime.UtcNow;
#endif
                chatView.Populate();
#if LOG4NET
                DateTime stop   = DateTime.UtcNow;
                double duration = stop.Subtract(start).TotalMilliseconds;
                f_Logger.Debug("OnChatSynced(): " +
                               "<" + chatView.ID + ">.Populate() " +
                               "Position: " + chatView.Position +
                               " done, took: " + Math.Round(duration) + " ms");
#endif

                chatView.ScrollToEnd();

                SyncedChats.Add(chatView);
                if (ChatSynced != null)
                {
                    ChatSynced(this, new ChatViewManagerChatSyncedEventArgs(chatView));
                }
                return(false);
            });
        }
Example #4
0
        public override void DisableChat(ChatModel chat)
        {
            ChatView chatView = GetChat(chat);

            if (chatView == null)
            {
 #if LOG4NET
                f_Logger.Warn("DisableChat(): chatView is null!");
#endif
                return;
            }

            SyncedChats.Remove(chatView);
            chatView.Disable();
        }
Example #5
0
        public void Clear()
        {
            Trace.Call();

            var chats = new List <ChatView>(f_Chats);

            foreach (var chat in chats)
            {
                // clean up ChatView and all notify related resources like
                // StatusIconManager, NotifyManager and IndicateManager
                RemoveChat(chat.ChatModel);
            }

            f_Config = null;
            SyncedChats.Clear();
            SyncManager.Clear();
        }