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); }
private void EntStaffMessageRecordChatPanel(System.Collections.Generic.List <MessageRecord> records) { long staffUid; if (records[0].from_uid != this.sessionService.Uid) { staffUid = records[0].from_uid; } else { staffUid = records[0].to_uid; } Message[] messages = new Message[records.Count]; MessageStyle ms = null; for (int i = 0; i < messages.Length; i++) { ms = this.StaffMessageRecordProcessor(records, ms, i); messages[i] = new Message(); messages[i].FromJid = records[i].from_uid + "@null/null"; messages[i].CreateTime = records[i].createTime; messages[i].FileName = records[i].fileName; messages[i].Icon = records[i].icon; messages[i].Url = records[i].url; messages[i].toUid = records[i].to_uid; if (this.sessionService.Uid == records[i].to_uid) { messages[i].ToJid = records[i].from_uid.ToString(); } else { messages[i].ToJid = records[i].to_uid.ToString(); } messages[i].MessageBlocks = this.utilService.MessageDecode(records[i].message); messages[i].Style = ms; } EntStaffTab item = this.dataService.GetStaffChatTab(staffUid) as EntStaffTab; if (item != null) { PersonalChatTabControl tab = item.TabContent; if (tab != null) { tab.ChatComponent.AddMessageRecords(messages, records[0].total); } } System.GC.Collect(); }
public EntStaffTab(Staff staff) { if (staff != null) { this.InitializeComponent(); this.staff = staff; this.TabHeader.Label = staff.Name; this.TabHeader.imgIcon.Source = staff.HeaderImage; base.Tag = new MenuItem { Icon = new Image { Width = 16.0, Height = 16.0, Source = staff.HeaderImage }, Header = staff.Name }; this.TabContent = new PersonalChatTabControl(staff); base.SetFocus2DesktopButton(); this.AddEventListenerHandler(); } }