private void RosterNewMessage(Message msg)
        {
            RosterTab item = this.dataService.GetRosterChatTab((long)((ulong)Jid.GetUid(msg.FromJid))) as RosterTab;

            if (item == null)
            {
                Roster roster = this.dataService.GetRoster((long)((ulong)Jid.GetUid(msg.FromJid)));
                if (roster != null)
                {
                    item = new RosterTab(roster);
                    item.SetDefaultStyle();
                    ((INWindow)this.dataService.INWindow).ContentTab.Items.Add(item);
                    this.dataService.AddRosterChatTab(roster.Uid, item);
                }
            }
            this.baseTab = item;
            FriendsChatTabControl tab = item.TabContent;

            if (tab != null)
            {
                tab.ChatComponent.AddMessageRoster(msg, false);
                tab.ChatComponent.inputMsgBox.Focus();
            }
        }
        private bool PickUpMessageProcessor()
        {
            bool           hasSelected = false;
            TabItem        tempItem    = null;
            ItemCollection ic          = this.inWindow.ContentTab.Items;

            foreach (TabItem item in (System.Collections.IEnumerable)ic)
            {
                if (item != null)
                {
                    CloseableTabItem     cti       = item as CloseableTabItem;
                    TabItemHeaderControl tabHeader = null;
                    if (cti != null)
                    {
                        tabHeader = (cti.Header as TabItemHeaderControl);
                    }
                    PersonalChatTabControl  pctc = item.Content as PersonalChatTabControl;
                    GroupChatTabControl     gctc = item.Content as GroupChatTabControl;
                    FriendsChatTabControl   fctc = item.Content as FriendsChatTabControl;
                    CoopStaffChatTabControl coopStaffChatTabControl = item.Content as CoopStaffChatTabControl;
                    if (pctc != null)
                    {
                        System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(pctc.StaffId, MessageActorType.EntStaff);
                        if (list != null)
                        {
                            if (tabHeader != null)
                            {
                                tabHeader.SetFlashingStyle();
                            }
                            this.ShowStaffNewMessage(pctc.StaffId, list);
                        }
                        if (!hasSelected)
                        {
                            hasSelected = this.HasSelectedItem(MessageActorType.CooperationStaff, pctc.StaffId);
                            if (hasSelected)
                            {
                                tempItem = item;
                            }
                        }
                    }
                    if (gctc != null)
                    {
                        System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(gctc.GroupId, MessageActorType.EntGroup);
                        if (list != null)
                        {
                            if (tabHeader != null)
                            {
                                tabHeader.SetFlashingStyle();
                            }
                            this.ShowGroupNewMessage(gctc.GroupId, list);
                        }
                        if (!hasSelected)
                        {
                            hasSelected = this.HasSelectedItem(MessageActorType.EntGroup, gctc.GroupId);
                            if (hasSelected)
                            {
                                tempItem = item;
                            }
                        }
                    }
                    if (fctc != null)
                    {
                        System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(fctc.RosterId, MessageActorType.Roster);
                        if (list != null)
                        {
                            if (tabHeader != null)
                            {
                                tabHeader.SetFlashingStyle();
                            }
                            this.ShowRosterNewMessage(fctc.RosterId, list);
                        }
                        if (!hasSelected)
                        {
                            hasSelected = this.HasSelectedItem(MessageActorType.AddRoster, fctc.RosterId);
                            if (hasSelected)
                            {
                                tempItem = item;
                            }
                        }
                    }
                    if (coopStaffChatTabControl != null)
                    {
                        System.Collections.Generic.List <Message> list = this.dataModel.GetCooperationStaffMessage(coopStaffChatTabControl.Uid, coopStaffChatTabControl.Projectid, MessageActorType.CooperationStaff);
                        if (list != null)
                        {
                            if (tabHeader != null)
                            {
                                tabHeader.SetFlashingStyle();
                            }
                            this.ShowCooperationStaffNewMessage(coopStaffChatTabControl.Uid, coopStaffChatTabControl.Projectid, list);
                        }
                        if (!hasSelected)
                        {
                            hasSelected = this.HasCoopeationSelectedItem(MessageActorType.CooperationStaff, coopStaffChatTabControl.Projectid);
                            if (hasSelected)
                            {
                                tempItem = item;
                            }
                        }
                    }
                }
            }
            if (tempItem != null)
            {
                this.baseTab = (tempItem as BaseTab);
            }
            return(hasSelected);
        }