private CloseableTabItem FindChatTab() { INWindow inWindow = this.dataService.INWindow as INWindow; CloseableTabItem result; if (inWindow != null) { ItemCollection ic = inWindow.ContentTab.Items; foreach (TabItem item in (System.Collections.IEnumerable)ic) { if (item != null) { CloseableTabItem cti = item as CloseableTabItem; if (cti != null) { TabItemHeaderControl tabHeader = cti.Header as TabItemHeaderControl; } PersonalChatTabControl pctc = item.Content as PersonalChatTabControl; if (pctc != null && this.staff != null && pctc.StaffId == this.staff.Uid) { result = cti; return(result); } } } } result = null; return(result); }
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); }