Ejemplo n.º 1
0
        private void CalculateUnreadCommunityMessageCount(InstanceAnswerPro.Core.Message message)
        {
            InstanceAnswerPro.Core.Community.Community community = InstanceAnswerPro.Core.ComponentManager.GetCommunitiesManager().GetCommunity((message as CommunityMessage).CommunityID);
            int messagesCount = this._messageCenter.GetMessagesCount(msg => msg.Tag == message.Tag);

            community.MessageCount = messagesCount;
        }
Ejemplo n.º 2
0
        //internal static void OnClickHyperlink(ImageHyperlink hyperlink, Window window, SessionTabItem sessionTabItem)
        //{
        //    try
        //    {
        //        Guid guid = hyperlink.Guid;
        //        string soureUrl = hyperlink.SoureUrl;
        //        if (!string.IsNullOrEmpty(soureUrl))
        //        {
        //            if (guid.Equals(MessageElementTags.GuidLinkFile))
        //            {
        //                if (File.Exists(soureUrl))
        //                {
        //                    BrowserHelper.OpenUrl(BrowserType.System, soureUrl);
        //                }
        //                else
        //                {
        //                    hyperlink.DisabledHyperLink();
        //                    MessageBox.Show(window, "此文件不存在");
        //                }
        //            }
        //            else if (guid.Equals(MessageElementTags.GuidLinkDirectory))
        //            {
        //                if (File.Exists(soureUrl))
        //                {
        //                    Process.Start("explorer.exe", "/select," + soureUrl);
        //                }
        //                else
        //                {
        //                    soureUrl = Path.GetDirectoryName(soureUrl);
        //                    if (Directory.Exists(soureUrl))
        //                    {
        //                        BrowserHelper.OpenUrl(BrowserType.System, soureUrl);
        //                    }
        //                    else
        //                    {
        //                        hyperlink.DisabledHyperLink();
        //                        MessageBox.Show(window, "此目录不存在");
        //                    }
        //                }
        //            }
        //            else if (guid.Equals(MessageElementTags.GuidLinkSendAgain))
        //            {
        //                hyperlink.DisabledHyperLink();
        //                Util_Misc.OpenSendFile(sessionTabItem.Uin, soureUrl);
        //            }
        //            else if (guid.Equals(MessageElementTags.GuidLinkSafePage) || guid.Equals(MessageElementTags.GuidLinkHttp))
        //            {
        //                BrowserHelper.OpenUrl(BrowserType.System, soureUrl);
        //            }
        //        }
        //    }
        //    catch (Exception)
        //    {
        //    }
        //}

        public void OnMessagePopped(InstanceAnswerPro.Core.Message message)
        {
            if (message.Type == InstanceAnswerPro.Core.MessageType.CommunityMessage)
            {
                this.CalculateUnreadCommunityMessageCount(message);
            }
        }
Ejemplo n.º 3
0
        public void OnNotifyMessage(InstanceAnswerPro.Core.Message message)
        {
            UICommandMessage message2 = message as UICommandMessage;

            if (message2 != null)
            {
                if (message2.CommandName == "OpenContactSessionWindow")
                {
                    Buddy buddy = message2.Parameter1 as Buddy;
                    Util_Buddy.BuddySessionParameter parameter = message2.Parameter2 as Util_Buddy.BuddySessionParameter;
                    Point?mousePosition = null;
                    if (parameter != null)
                    {
                        mousePosition = new Point?(parameter.WindowPosition);
                    }
                    if ((parameter == null) || (parameter.ContactSessionWindowStatus != Util_Buddy.ContactSessionWindowStatus.Avatar))
                    {
                        if (!ContactSessionWindow.ActiveSessionWhenExist(buddy.Uin, mousePosition))
                        {
                            this.CreateContactSessionWindow(buddy.Uin, message2.Parameter2);
                        }
                    }
                    else if (!ContactSessionWindow.ActiveSessionWhenExist(buddy.Uin, mousePosition))
                    {
                        //this.CreateDesktopBuddy(buddy, mousePosition);
                    }
                }
                else if (message2.CommandName == "OpenCommunitySessionWindow")
                {
                    InstanceAnswerPro.Core.Community.Community community = message2.Parameter1 as InstanceAnswerPro.Core.Community.Community;
                    if (!CommunitySessionWindow.ActiveSessionWhenExist(this._communitySessionManager.GetCommunitySession(community.Id, true)))
                    {
                        this.CreateCommunitySessionWindow(community.Id);
                    }
                }
                else if (message2.CommandName == "OpenContactSession")
                {
                    ContactSessionWindow.CloseSessionWhenExist((uint)message2.Parameter1);
                }
                else if (message2.CommandName == "Conversation")
                {
                    string str = message2.Parameter1 as string;
                    UICommand.Parameter2.ConversationEventInfo info = message2.Parameter2 as UICommand.Parameter2.ConversationEventInfo;
                    switch (str)
                    {
                    case "CloseConversation":
                        CommunitySessionWindow.CloseCommunityWindowByID(info.ConversationID);
                        return;

                    case "RefreshConversationPic":
                        CommunitySessionWindow.RefreshConversationPic(info.ConversationID, info.PicGuid, info.IsPicReceiveSuccess, info.Info);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void OnViewMessage(InstanceAnswerPro.Core.Message message)
        {
            InfoMessage message4;

            InstanceAnswerPro.Core.MessageType type = message.Type;
            if (type != InstanceAnswerPro.Core.MessageType.ContactMessage)
            {
                if (type != InstanceAnswerPro.Core.MessageType.CommunityMessage)
                {
                    if (type != InstanceAnswerPro.Core.MessageType.InfoMessage)
                    {
                        return;
                    }
                    goto Label_00B2;
                }
            }
            else
            {
                using (new Util_Perf.FunLog("ConversationModule.OnViewMessage  MessageType.ContactMessage"))
                {
                    ContactMessage message2 = message as ContactMessage;
                    if (!ContactSessionWindow.ActiveSessionWhenExist(message2.Uin, null))
                    {
                        this.CreateContactSessionWindow(message2.Uin);
                    }
                    return;
                }
            }
            using (new Util_Perf.FunLog("ConversationModule.OnViewMessage  MessageType.CommunityMessage"))
            {
                CommunityMessage message3 = message as CommunityMessage;
                if (!CommunitySessionWindow.ActiveSessionWhenExist(this._communitySessionManager.GetCommunitySession(message3.CommunityID, true)))
                {
                    this.CreateCommunitySessionWindow(message3.CommunityID);
                }
                return;
            }
Label_00B2:
            message4 = message as InfoMessage;
            if (message4.IsCommunityMsg)
            {
                if (!CommunitySessionWindow.ActiveSessionWhenExist(this._communitySessionManager.GetCommunitySession(message4.Uin, true)))
                {
                    this.CreateCommunitySessionWindow(message4.Uin);
                }
            }
            else if (!ContactSessionWindow.ActiveSessionWhenExist(message4.Uin, null))
            {
                this.CreateContactSessionWindow(message4.Uin);
            }
        }
Ejemplo n.º 5
0
 public void OnMessagePushed(InstanceAnswerPro.Core.Message message)
 {
     if (message.Type == InstanceAnswerPro.Core.MessageType.InfoMessage)
     {
         InfoMessage infoMessage = (InfoMessage)message;
         if (!infoMessage.IsCommunityMsg)
         {
             ContactSession contactSession = this._contactSessionManager.GetContactSession(infoMessage.Uin, false);
             if (contactSession != null)
             {
                 contactSession.OnMessageReceived(infoMessage);
                 this._messageCenter.PopMessage(infoMessage);
             }
         }
         else
         {
             CommunitySession communitySession = this._communitySessionManager.GetCommunitySession(infoMessage.Uin, false);
             if (communitySession != null)
             {
                 communitySession.OnMessageReceived(infoMessage);
                 this._messageCenter.PopMessage(infoMessage);
             }
         }
     }
     else if (message.Type == InstanceAnswerPro.Core.MessageType.ContactMessage)
     {
         ContactMessage message3 = (ContactMessage)message;
         this._messageCenter.NotifyMessage(new UICommandMessage("AddRecentContact", InstanceAnswerPro.Core.MessageType.ContactMessage, message3.Uin));
     }
     else if (message.Type == InstanceAnswerPro.Core.MessageType.CommunityMessage)
     {
         CommunityMessage message4 = (CommunityMessage)message;
         this._messageCenter.NotifyMessage(new UICommandMessage("AddRecentContact", InstanceAnswerPro.Core.MessageType.CommunityMessage, message4.CommunityID));
         this.CalculateUnreadCommunityMessageCount(message4);
     }
 }