コード例 #1
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;
                    }
                }
            }
        }
コード例 #2
0
        private void CreateContactSessionWindow(uint uin, object parameter)
        {
            //DesktopBuddy buddy = null;
            //object obj2 = CoreMessenger.Instance.WindowManager.FireEvent("DesktopBuddy", WindowEvent.FindWindow, uin, null);
            Util_Buddy.BuddySessionParameter parameter2 = parameter as Util_Buddy.BuddySessionParameter;
            //if (obj2 is DesktopBuddy)
            //{
            //    buddy = (DesktopBuddy) obj2;
            //    if (parameter2 == null)
            //    {
            //        parameter2 = new Util_Buddy.BuddySessionParameter {
            //            ContactSessionWindowStatus = Util_Buddy.ContactSessionWindowStatus.Dialog
            //        };
            //    }
            //    parameter2.OpenFromDesktopBuddy = true;
            //    parameter2.WindowPosition = new Point(buddy.Left, buddy.Top);
            //    buddy.DestroySession();
            //    buddy.Close();
            //}
            ContactSession       contactSession = this._contactSessionManager.GetContactSession(uin, true);
            ContactSessionWindow window         = new ContactSessionWindow(contactSession, null, (parameter2 != null) ? parameter2.OpenFromDesktopBuddy : false);

            foreach (InstanceAnswerPro.Core.Message message in this._messageCenter.PopMessages(delegate(InstanceAnswerPro.Core.Message message)
            {
                if (message.Type == InstanceAnswerPro.Core.MessageType.ContactMessage)
                {
                    ContactMessage message2 = message as ContactMessage;
                    if (message2.Uin == uin)
                    {
                        return(true);
                    }
                }
                else if (message.Type == InstanceAnswerPro.Core.MessageType.InfoMessage)
                {
                    InfoMessage message3 = message as InfoMessage;
                    if (!message3.IsCommunityMsg && (message3.Uin == uin))
                    {
                        return(true);
                    }
                }
                return(false);
            }, true))
            {
                window.ReceiveMessage(contactSession, message);
            }
            if (parameter2 != null)
            {
                FrameworkElement content = window.Content as FrameworkElement;
                window.Left = parameter2.WindowPosition.X - content.Margin.Left;
                window.Top  = parameter2.WindowPosition.Y - content.Margin.Top;
            }
            window.Show();
        }
コード例 #3
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);
            }
        }
コード例 #4
0
 public static bool ActiveSessionWhenExist(uint uin, Point?mousePosition)
 {
     for (int i = 0; i < ContactSessionWindows.Count; i++)
     {
         SessionTabItem item = ContactSessionWindows[i].FindIMSession(uin);
         if (item != null)
         {
             ContactSessionWindow window = ContactSessionWindows[i];
             if (window.WindowState == WindowState.Minimized)
             {
                 window.WindowState = WindowState.Normal;
             }
             ContactSessionWindows[i].Activate();
             ContactSessionWindows[i].CurrentIMSession = item;
             return(true);
         }
     }
     return(false);
 }
コード例 #5
0
 private void ContactSessionManager_ImageTransferStatusChanged(object sender, ImageTransferStatusChangedrEventArgs e)
 {
     ContactSessionWindow.OnImageTransferStatusChanged(e);
 }
コード例 #6
0
 private void InitXaml()
 {
     ContactSessionWindow.InitXaml();
     CommunitySessionWindow.InitXaml();
 }
コード例 #7
0
 private void CreateContactSessionWindow(uint uin, object parameter)
 {
     //DesktopBuddy buddy = null;
     //object obj2 = CoreMessenger.Instance.WindowManager.FireEvent("DesktopBuddy", WindowEvent.FindWindow, uin, null);
     Util_Buddy.BuddySessionParameter parameter2 = parameter as Util_Buddy.BuddySessionParameter;
     //if (obj2 is DesktopBuddy)
     //{
     //    buddy = (DesktopBuddy) obj2;
     //    if (parameter2 == null)
     //    {
     //        parameter2 = new Util_Buddy.BuddySessionParameter {
     //            ContactSessionWindowStatus = Util_Buddy.ContactSessionWindowStatus.Dialog
     //        };
     //    }
     //    parameter2.OpenFromDesktopBuddy = true;
     //    parameter2.WindowPosition = new Point(buddy.Left, buddy.Top);
     //    buddy.DestroySession();
     //    buddy.Close();
     //}
     ContactSession contactSession = this._contactSessionManager.GetContactSession(uin, true);
     ContactSessionWindow window = new ContactSessionWindow(contactSession, null, (parameter2 != null) ? parameter2.OpenFromDesktopBuddy : false);
     foreach (InstanceAnswerPro.Core.Message message in this._messageCenter.PopMessages(delegate(InstanceAnswerPro.Core.Message message)
     {
         if (message.Type == InstanceAnswerPro.Core.MessageType.ContactMessage)
         {
             ContactMessage message2 = message as ContactMessage;
             if (message2.Uin == uin)
             {
                 return true;
             }
         }
         else if (message.Type == InstanceAnswerPro.Core.MessageType.InfoMessage)
         {
             InfoMessage message3 = message as InfoMessage;
             if (!message3.IsCommunityMsg && (message3.Uin == uin))
             {
                 return true;
             }
         }
         return false;
     }, true))
     {
         window.ReceiveMessage(contactSession, message);
     }
     if (parameter2 != null)
     {
         FrameworkElement content = window.Content as FrameworkElement;
         window.Left = parameter2.WindowPosition.X - content.Margin.Left;
         window.Top = parameter2.WindowPosition.Y - content.Margin.Top;
     }
     window.Show();
 }