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(); } }
public NewFileListItem(string fileName, string id, long size, CoopStaffChatTabControl coopStaffChatTab, CooperationStaff coopStaff, string iconBase64) { if (coopStaffChatTab != null && coopStaff != null) { this.InitializeComponent(); this.coopStaffChatTab = coopStaffChatTab; this.coopStaff = coopStaff; this.item = new FileItem(id, this.fileDir + fileName); this.item.FileService = this.fileService; this.item.ProcessEvent = new ProcessEvent(this.ProcessEventHandle); this.item.EndEvent = new EndEvent(this.EndEventHandle); this.item.ErrorEvent = new ErrorEvent(this.ErrorEventHandle); this.item.IconBase64 = iconBase64; this.IconBase64 = iconBase64; this.imgIcon.Source = this.IconDecode(this.IconBase64); this.progressBar.Maximum = (double)size; this.tbkFilename.Text = fileName; this.fileName = fileName; this.tbkMsg.Text = "收到文件请求"; this.tbkSize.Text = this.GetLength(size); this.ShowAcceptButton(); } }
public NewFileListItem(System.IO.FileInfo fileInfo, CoopStaffChatTabControl coopStaffChatTab, CooperationStaff coopStaff) { try { this.InitializeComponent(); if (fileInfo != null && coopStaffChatTab != null && coopStaff != null) { this.fileInfo = fileInfo; this.coopStaffChatTab = coopStaffChatTab; this.coopStaff = coopStaff; this.item = new FileItem(fileInfo); this.item.IsToCenter = true; this.item.Projectid = coopStaff.UnitedProjectid; this.item.FromUid = this.sessionService.Uid; this.item.ToJid = coopStaff.Jid; this.item.ToUid = coopStaff.Uid; this.item.FileService = this.fileService; this.item.ProcessEvent = new ProcessEvent(this.ProcessEventHandle); this.item.EndEvent = new EndEvent(this.EndEventHandle); this.item.ErrorEvent = new ErrorEvent(this.ErrorEventHandle); this.item.StopEvent = new StopEvent(this.StopEventHandle); this.progressBar.Maximum = (double)fileInfo.Length; this.imgIcon.Source = this.IconToBitmap(Icon.ExtractAssociatedIcon(fileInfo.FullName)); this.IconBase64 = this.IconToBase64(Icon.ExtractAssociatedIcon(fileInfo.FullName)); this.item.IconBase64 = this.IconBase64; this.tbkFilename.Text = fileInfo.Name.Trim(); this.fileName = fileInfo.Name.Trim(); this.tbkMsg.Text = "正在发送文件"; this.tbkSize.Text = this.GetLength(fileInfo.Length); this.ShowCancelButton(); } } catch (System.Exception e) { this.logger.Error(e.ToString()); } }
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); }