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(); } }
private void PickUpAllHandler(object sender, MouseButtonEventArgs e) { try { MessageBoxItem[] stackPanels = new MessageBoxItem[this.lbMessageBox.Items.Count]; this.lbMessageBox.Items.CopyTo(stackPanels, 0); MessageBoxItem[] array = stackPanels; for (int i = 0; i < array.Length; i++) { MessageBoxItem mbi = array[i]; mbi.PickUpMessage(); } array = stackPanels; for (int i = 0; i < array.Length; i++) { MessageBoxItem mbi = array[i]; BaseTab baseTab = this.FindChatTab(mbi.MessageType, mbi.Id, mbi.Projectid); if (baseTab != null) { baseTab.SetFlashingStyle(); } } INWindow inWindow = this.dataService.INWindow as INWindow; BaseTab selectedTab = inWindow.ContentTab.SelectedItem as BaseTab; if (selectedTab != null) { selectedTab.SetDefaultStyle(); } this.ActiveInWindow(); } catch (System.Exception ex) { this.logger.Error(ex.ToString()); } }
private BaseTab FindChatTab(MessageActorType type, long id, string projectid) { INWindow inWindow = this.dataService.INWindow as INWindow; BaseTab result; if (inWindow != null) { ItemCollection ic = inWindow.ContentTab.Items; foreach (TabItem item in (System.Collections.IEnumerable)ic) { if (item != null) { BaseTab cti = item as BaseTab; if (MessageActorType.EntGroup == type) { GroupChatTabControl gctc = item.Content as GroupChatTabControl; if (gctc != null && gctc.GroupId == id) { result = cti; return(result); } } if (MessageActorType.EntStaff == type) { PersonalChatTabControl pctc = item.Content as PersonalChatTabControl; if (pctc != null && pctc.StaffId == id) { result = cti; return(result); } } if (MessageActorType.Roster == type) { FriendsChatTabControl fctc = item.Content as FriendsChatTabControl; if (fctc != null && fctc.RosterId == id) { result = cti; return(result); } } if (MessageActorType.CooperationStaff == type) { CoopStaffChatTabControl coopStaffChatTabControl = item.Content as CoopStaffChatTabControl; if (coopStaffChatTabControl != null && coopStaffChatTabControl.Uid == id && coopStaffChatTabControl.Projectid == projectid) { result = cti; return(result); } } } } } result = null; return(result); }
public App() { try { InitializeComponent(); MainPage = new BaseTab(); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }
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 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 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 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); }