private void UserControl_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { if (e.LeftButton == MouseButtonState.Pressed && this.staff.Uid != this.sessionService.Uid) { CoopStaffTab item = this.dataService.GetCooperationStaffChatTab(this.staff.Uid, this.staff.UnitedProjectid) as CoopStaffTab; if (item != null) { ((INWindow)this.dataService.INWindow).ContentTab.SelectedItem = item; } else { item = new CoopStaffTab(this.staff, this.cooperationProjectWrapper); item.SetDefaultStyle(); ((INWindow)this.dataService.INWindow).ContentTab.Items.Add(item); this.dataService.AddCooperationStaffChatTab(this.staff.Uid, this.staff.UnitedProjectid, item); ((INWindow)this.dataService.INWindow).ContentTab.SelectedItem = item; this.MessageProcessor(item); } } } catch (System.Exception) { } }
private void MessageProcessor(CoopStaffTab item) { if (item != null) { System.Collections.Generic.List<Message> list = DataModel.Instance.GetCooperationStaffMessage(this.staff.Uid, this.staff.UnitedProjectid, MessageActorType.CooperationStaff); if (list != null && list.Count > 0) { foreach (Message message in list) { item.TabContent.ChatComponent.AddCooperationMessageStaff(message, false); item.TabContent.ChatComponent.inputMsgBox.Focus(); } } DataModel.Instance.RemoveCooperationStatffMessage(this.staff.Uid, this.staff.UnitedProjectid, MessageActorType.CooperationStaff); MessageBoxWindow mbw = DataModel.Instance.GetMessageBox(); if (mbw != null) { mbw.Refresh(); } } }
private void CooperationStaffFileDownloadEvent(CooperationFileDownloadResponse response) { try { INWindow inWindow = this.dataService.INWindow as INWindow; if (response != null && inWindow != null) { CoopStaffTab item = this.dataService.GetCooperationStaffChatTab(response.fromUid, response.projectId) as CoopStaffTab; if (item == null) { CooperationStaff staff = this.dataService.GetCooperationStaff(response.fromUid, response.projectId); CooperationProjectWrapper cooperationProjectWrapper = this.dataService.GetCooperationProjectWrapper(response.projectId); if (staff != null && cooperationProjectWrapper != null) { item = new CoopStaffTab(staff, cooperationProjectWrapper); item.SetFlashingStyle(); ((INWindow)this.dataService.INWindow).ContentTab.Items.Add(item); this.dataService.AddCooperationStaffChatTab(staff.Uid, staff.UnitedProjectid, item); } } if (item != null) { CoopStaffChatTabControl tab = item.TabContent; if (tab != null) { tab.AddReceiveHttpFile(response); if (!this.IsCurrentItem(item)) { item.SetFlashingStyle(); } } } this.PickUpMessageProcessor(); MessageBoxWindow mbw = this.dataModel.GetMessageBox(); if (mbw != null) { mbw.Refresh(); } if (inWindow.WindowState == WindowState.Minimized && item != null) { this.ActiveInWindow(); this.SelectedTab(item); } else { this.ActiveInWindow(); } this.FlashIconPorcessor(); } } catch (System.Exception) { } }
private void CooperationStaffNewMessage(IDKin.IM.Core.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); ((INWindow)this.dataService.INWindow).ContentTab.SelectedItem = item; } } CoopStaffChatTabControl tab = item.TabContent; if (tab != null) { tab.ChatComponent.AddCooperationMessageStaff(message, false); tab.ChatComponent.inputMsgBox.Focus(); } }
private void CooperationCommonEvent(CooperationCommonResponse response) { if (response != null) { CoopStaffTab item = this.dataService.GetCooperationStaffChatTab((long)((ulong)Jid.GetUid(response.from_jid)), response.projectID) as CoopStaffTab; if (item == null) { CooperationStaff staff = this.dataService.GetCooperationStaff((long)((ulong)Jid.GetUid(response.from_jid)), response.projectID); CooperationProjectWrapper cooperationProjectWrapper = this.dataService.GetCooperationProjectWrapper(response.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); } } if (item != null) { this.ActiveInWindow(); this.PickUpMessageProcessor(); MessageBoxWindow mbw = this.dataModel.GetMessageBox(); if (mbw != null) { mbw.Refresh(); } this.FlashIconPorcessor(); CooperationStaff staff = this.dataService.GetCooperationStaff((long)((ulong)Jid.GetUid(response.from_jid)), response.projectID); if (staff != null) { item.TabContent.ChatComponent.AddMessageNotice(staff.Name + "给你发送了一个震动!"); this.SelectedTab(item); item.TabContent.ChatComponent.Vibration(true); } } } }