Ejemplo n.º 1
0
 public void View()
 {
     if (this._messages.Count > 0)
     {
         CoreMessenger.Instance.MessageCenter.ViewMessage(this._messages[0]);
     }
     else if (this._messageType == MessageType.CommunityMessage)
     {
         uint             communityID      = uint.Parse(this.MessageTag);
         CommunityManager communityManager = ComponentManager.GetCommunitiesManager().GetCommunityManager(communityID, false);
         if (communityManager != null)
         {
             InstanceAnswerPro.Core.Community.Community community = communityManager.GetCommunity(false);
             if (community != null)
             {
                 UICommandMessage message = new UICommandMessage("OpenCommunitySessionWindow", community, null);
                 CoreMessenger.Instance.MessageCenter.NotifyMessage(message);
             }
         }
     }
     else if (this._messageType == MessageType.ContactMessage)
     {
         Util_Buddy.OpenContactSessionWindow(uint.Parse(this.MessageTag));
     }
 }
Ejemplo n.º 2
0
 internal override bool OnUICommandMessage(UICommandMessage uICommandMessage)
 {
     if(uICommandMessage== null)
     {
         throw new ArgumentNullException("uICommandMessage");
     }
     switch(uICommandMessage.Command)
     {
         case UICommand.MoveUp:
             Move("north");
             return true;
         case UICommand.MoveDown:
             Move("south");
             return true;
         case UICommand.MoveLeft:
             Move("west");
             return true;
         case UICommand.MoveRight:
             Move("east");
             return true;
         case UICommand.Start:
             return HandleMessage(new ShowMainMenuMessage());
         default:
             return false;
     }
 }
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;
                    }
                }
            }
        }
 public bool ProcessEnterKey()
 {
     InstanceAnswerPro.Core.Community.Community selectedItem = this.communityListBox.SelectedItem as InstanceAnswerPro.Core.Community.Community;
     if (selectedItem != null)
     {
         UICommandMessage message = new UICommandMessage("OpenCommunitySessionWindow", selectedItem, null);
         this._messageCenter.NotifyMessage(message);
         return(true);
     }
     return(false);
 }
        protected void OnItemDoubleClicked(object sender, MouseButtonEventArgs e)
        {
            DependencyObject originalSource = e.OriginalSource as DependencyObject;

            if (originalSource != null)
            {
                ListBox     ancestorByType = VisualTree.GetAncestorByType(originalSource, typeof(ListBox)) as ListBox;
                ListBoxItem container      = VisualTree.GetAncestorByType(originalSource, typeof(ListBoxItem)) as ListBoxItem;
                if ((ancestorByType != null) && (container != null))
                {
                    Community community = ancestorByType.ItemContainerGenerator.ItemFromContainer(container) as Community;
                    if (community != null)
                    {
                        UICommandMessage message = new UICommandMessage("OpenCommunitySessionWindow", community, null);
                        this._messageCenter.NotifyMessage(message);
                    }
                    e.Handled = true;
                }
            }
        }
 internal override bool OnUICommandMessage(UICommandMessage uICommandMessage)
 {
     throw new NotImplementedException();
 }
        internal override bool OnUICommandMessage(UICommandMessage uICommandMessage)
        {
            if(uICommandMessage== null)
            {
                throw new ArgumentNullException("uICommandMessage");
            }

            switch(uICommandMessage.Command)
            {
                case UICommand.Confirm:
                case UICommand.Cancel:
                    HandleMessage(new ClearNotificationMessage());
                    return true;
                default:
                    return false;
            }
        }
 private void NotifyAIOSessionEvent(string aioHandle, Buddy buddy)
 {
     UICommandMessage message = new UICommandMessage("AIOSession", aioHandle, new UICommand.Parameter2.AIOSessionEventInfo(this, buddy));
     CoreMessenger.Instance.MessageCenter.NotifyMessage(message);
 }
        public void OnNotifyMessage(Message message)
        {
            UICommandMessage message2 = message as UICommandMessage;

            if (message2 != null)
            {
                if (message2.CommandName == "AddRecentContact")
                {
                    InstanceAnswerPro.Core.MessageType messageType = (InstanceAnswerPro.Core.MessageType)message2.Parameter1;
                    uint id    = (uint)message2.Parameter2;
                    int  index = ObservableCollectionHelper.FindFirst <object>(this.recentContactCollection, delegate(object contact)
                    {
                        Buddy buddy = contact as Buddy;
                        InstanceAnswerPro.Core.Community.Community community = contact as InstanceAnswerPro.Core.Community.Community;
                        return((((messageType == InstanceAnswerPro.Core.MessageType.ContactMessage) && (buddy != null)) && (id == buddy.Uin)) || (((messageType == InstanceAnswerPro.Core.MessageType.CommunityMessage) && (community != null)) && (id == community.Id)));
                    });
                    if (index >= 0)
                    {
                        this.recentContactCollection.RemoveAt(index);
                    }
                    switch (messageType)
                    {
                    case InstanceAnswerPro.Core.MessageType.ContactMessage:
                    {
                        Buddy item = BuddyListBuilder.Instance.FindOrCreateBuddy(id, false, false);
                        if (item != null)
                        {
                            this.recentContactCollection.Insert(0, item);
                        }
                        break;
                    }

                    case InstanceAnswerPro.Core.MessageType.CommunityMessage:
                    {
                        InstanceAnswerPro.Core.Community.Community community = ComponentManager.GetCommunitiesManager().GetCommunity(id);
                        if (community != null)
                        {
                            this.recentContactCollection.Insert(0, community);
                        }
                        break;
                    }
                    }
                    int count = this.recentContactCollection.Count;
                    if (count > 30)
                    {
                        this.recentContactCollection.RemoveAt(count - 1);
                    }
                }
                else if (message2.CommandName == "RemoveRecentContact")
                {
                    InstanceAnswerPro.Core.MessageType messageType = (InstanceAnswerPro.Core.MessageType)message2.Parameter1;
                    uint id   = (uint)message2.Parameter2;
                    int  num3 = ObservableCollectionHelper.FindFirst <object>(this.recentContactCollection, delegate(object contact)
                    {
                        Buddy buddy = contact as Buddy;
                        InstanceAnswerPro.Core.Community.Community community = contact as InstanceAnswerPro.Core.Community.Community;
                        return((((messageType == InstanceAnswerPro.Core.MessageType.ContactMessage) && (buddy != null)) && (id == buddy.Uin)) || (((messageType == InstanceAnswerPro.Core.MessageType.CommunityMessage) && (community != null)) && (id == community.Id)));
                    });
                    if (num3 >= 0)
                    {
                        this.recentContactCollection.RemoveAt(num3);
                    }
                }
            }
        }
Ejemplo n.º 10
0
 private bool OnUICommandMessage(UICommandMessage uICommandMessage)
 {
     switch(uICommandMessage.Command)
     {
         case UICommand.Start:
             ShowMainMenu();
             return true;
         default:
             return false;
     }
 }
Ejemplo n.º 11
0
 public bool DispachUICommand(UICommand command)
 {
     var message = new UICommandMessage(command);
     if (UICommandFocus==null)
     {
         return HandleNotify(message);
     }
     else
     {
         return UICommandFocus.OnMessage(message);
     }
 }
Ejemplo n.º 12
0
 internal abstract bool OnUICommandMessage(UICommandMessage uICommandMessage);
Ejemplo n.º 13
0
 public void View()
 {
     if (this._messages.Count > 0)
     {
         CoreMessenger.Instance.MessageCenter.ViewMessage(this._messages[0]);
     }
     else if (this._messageType == MessageType.CommunityMessage)
     {
         uint communityID = uint.Parse(this.MessageTag);
         CommunityManager communityManager = ComponentManager.GetCommunitiesManager().GetCommunityManager(communityID, false);
         if (communityManager != null)
         {
             InstanceAnswerPro.Core.Community.Community community = communityManager.GetCommunity(false);
             if (community != null)
             {
                 UICommandMessage message = new UICommandMessage("OpenCommunitySessionWindow", community, null);
                 CoreMessenger.Instance.MessageCenter.NotifyMessage(message);
             }
         }
     }
     else if (this._messageType == MessageType.ContactMessage)
     {
         Util_Buddy.OpenContactSessionWindow(uint.Parse(this.MessageTag));
     }
 }
        private void NotifyAIOSessionEvent(string aioHandle, Buddy buddy)
        {
            UICommandMessage message = new UICommandMessage("AIOSession", aioHandle, new UICommand.Parameter2.AIOSessionEventInfo(this, buddy));

            CoreMessenger.Instance.MessageCenter.NotifyMessage(message);
        }