Esempio n. 1
0
 private void SelectedTab(BaseTab baseTab)
 {
     INWindow inWindow = this.dataService.INWindow as INWindow;
     if (baseTab != null && inWindow != null)
     {
         inWindow.ContentTab.SelectedItem = baseTab;
         baseTab.SetDefaultStyle();
     }
 }
 private void StaffNewMessage(Message message)
 {
     EntStaffTab item = this.dataService.GetStaffChatTab((long)((ulong)Jid.GetUid(message.FromJid))) as EntStaffTab;
     if (item == null)
     {
         Staff staff = this.dataService.GetStaff((long)((ulong)Jid.GetUid(message.FromJid)));
         if (staff != null)
         {
             item = new EntStaffTab(staff);
             item.SetDefaultStyle();
             ((INWindow)this.dataService.INWindow).ContentTab.Items.Add(item);
             this.dataService.AddStaffChatTab(staff.Uid, item);
         }
     }
     this.baseTab = item;
     PersonalChatTabControl tab = item.TabContent;
     if (tab != null)
     {
         tab.ChatComponent.AddMessageStaff(message, false);
         tab.ChatComponent.inputMsgBox.Focus();
     }
 }
 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;
 }
 private void GroupNewMessage(Message message)
 {
     EntGroupTab item = this.dataService.GetEntGroupChatTab(message.Gid) as EntGroupTab;
     if (item == null)
     {
         EntGroup group = this.dataService.GetEntGroup(message.Gid);
         if (group != null)
         {
             item = new EntGroupTab(group);
             item.SetDefaultStyle();
             ((INWindow)this.dataService.INWindow).ContentTab.Items.Add(item);
             this.dataService.AddEntGroupChatTab(group.Gid, item);
         }
     }
     this.baseTab = item;
     GroupChatTabControl tab = item.TabContent;
     if (tab != null)
     {
         tab.ChatComponent.AddMessageGroup(message, false);
         tab.ChatComponent.inputMsgBox.Focus();
     }
 }
 private void CooperationStaffNewMessage(Message message)
 {
     CoopStaffTab item = this.dataService.GetCooperationStaffChatTab((long)((ulong)Jid.GetUid(message.FromJid)), message.ProjectId) as CoopStaffTab;
     if (item == null)
     {
         CooperationStaff staff = this.dataService.GetCooperationStaff((long)((ulong)Jid.GetUid(message.FromJid)), message.ProjectId);
         CooperationProjectWrapper cooperationProjectWrapper = this.dataService.GetCooperationProjectWrapper(message.ProjectId);
         if (staff != null && cooperationProjectWrapper != null)
         {
             item = new CoopStaffTab(staff, cooperationProjectWrapper);
             item.SetDefaultStyle();
             ((INWindow)this.dataService.INWindow).ContentTab.Items.Add(item);
             this.dataService.AddCooperationStaffChatTab(staff.Uid, staff.UnitedProjectid, item);
         }
     }
     this.baseTab = item;
     CoopStaffChatTabControl tab = item.TabContent;
     if (tab != null)
     {
         tab.ChatComponent.AddCooperationMessageStaff(message, false);
         tab.ChatComponent.inputMsgBox.Focus();
     }
 }