public void SetMessageBox(MessageBoxWindow window) { if (this.window == null) { this.window = new System.Collections.Generic.Dictionary<DataService.WindowType, Window>(); } if (!this.window.ContainsKey(DataService.WindowType.MessageBox)) { this.window.Add(DataService.WindowType.MessageBox, window); } }
private void CooperationStaffMessageEvent(CooperationMessageResponse response) { try { if (response != null) { if (response.type != 3 && response.type != 6) { Message msg = new Message(); MessageStyle ms = new MessageStyle(response.style); msg.CreateTime = response.date; msg.FromJid = response.from_jid; msg.ProjectId = response.project_id; msg.MessageBlocks = this.utilService.MessageDecode(response.message); msg.MessageString = response.message; msg.Style = ms; msg.VOType = response.type; msg.MessageObjectType = MessageActorType.CooperationStaff; this.AutoReplyCooperationMessageProcessor(msg); if (this.IsNotifyFlashing(msg)) { NotifyIconUtil.Instance.SetFlashIcon(FlashIconType.EntStaff); NotifyIconUtil.Instance.StartFlashing(); this.dataModel.AddCooperationStatffMessage((long)((ulong)Jid.GetUid(msg.FromJid)), msg.ProjectId, MessageActorType.CooperationStaff, msg); if (this.IsAddMessageBox()) { MessageBoxWindow mbw = this.dataModel.GetMessageBox(); if (mbw == null) { mbw = new MessageBoxWindow(); this.dataModel.SetMessageBox(mbw); } mbw.Refresh(); mbw.Show(); } } else { this.CooperationStaffAddMessage(msg); } } } } catch (System.Exception ex) { System.Console.WriteLine(ex.ToString()); } }
private void AddRosterAskTip(Message message, long uid) { this.dataModel.AddMessage(uid, message.MessageObjectType, message); NotifyIconUtil.Instance.SetFlashIcon(FlashIconType.MessageCenter); NotifyIconUtil.Instance.StartFlashing(); if (this.IsAddMessageBox()) { MessageBoxWindow mbw = this.dataModel.GetMessageBox(); if (mbw == null) { mbw = new MessageBoxWindow(); this.dataModel.SetMessageBox(mbw); } mbw.Refresh(); mbw.Show(); } }
private void RosterMessageEvent(RosterMessage response) { try { if (response != null) { Message msg = new Message(); MessageStyle ms = new MessageStyle(response.style); msg.CreateTime = response.date; msg.FromJid = response.fromJID; msg.MessageBlocks = this.utilService.MessageDecode(response.message); msg.Style = ms; msg.VOType = response.type; msg.MessageObjectType = MessageActorType.Roster; if (this.IsNotifyFlashing(msg)) { NotifyIconUtil.Instance.SetFlashIcon(FlashIconType.Roster); NotifyIconUtil.Instance.StartFlashing(); this.dataModel.AddMessage((long)((ulong)Jid.GetUid(msg.FromJid)), MessageActorType.Roster, msg); if (this.IsAddMessageBox()) { MessageBoxWindow mbw = this.dataModel.GetMessageBox(); if (mbw == null) { mbw = new MessageBoxWindow(); this.dataModel.SetMessageBox(mbw); } mbw.Refresh(); mbw.Show(); } } else { this.RosterAddMessage(msg); } } } catch (System.Exception ex) { System.Console.WriteLine(ex.ToString()); } }
private void EntMessageEvent(MessageResponse response) { try { if (response != null) { if (response.type != 3 && response.type != 6) { Message msg = new Message(); MessageStyle ms = new MessageStyle(response.style); msg.CreateTime = response.date; msg.FromJid = response.from_jid; msg.MessageBlocks = this.utilService.MessageDecode(response.message); msg.MessageString = response.message; msg.Style = ms; msg.VOType = response.type; msg.MessageObjectType = MessageActorType.EntStaff; this.AutoReplyProcessor(msg); if (this.IsNotifyFlashing(msg)) { NotifyIconUtil.Instance.SetFlashIcon(FlashIconType.EntStaff); NotifyIconUtil.Instance.StartFlashing(); this.dataModel.AddMessage((long)((ulong)Jid.GetUid(msg.FromJid)), MessageActorType.EntStaff, msg); if (this.IsAddMessageBox()) { MessageBoxWindow mbw = this.dataModel.GetMessageBox(); if (mbw == null) { mbw = new MessageBoxWindow(); this.dataModel.SetMessageBox(mbw); } mbw.Refresh(); mbw.Show(); } } else { this.StaffAddMessage(msg); } INWindow inWindow = this.dataService.INWindow as INWindow; if (inWindow != null) { inWindow.Employee.RecentLinkListItem.AddRecentLink(RecentLinkType.EntStaffChat, (long)((ulong)Jid.GetUid(msg.FromJid))); } } } } catch (System.Exception ex) { System.Console.WriteLine(ex.ToString()); } }
private void EntGroupMessageEvent(GroupMessageResponse response) { try { if (response != null && response.from_jid != this.sessionService.Jid && response.type == 0) { Message msg = new Message(); MessageStyle ms = new MessageStyle(response.style); msg.CreateTime = response.date; msg.FromJid = response.from_jid; msg.MessageBlocks = this.utilService.MessageDecode(response.message); msg.Gid = response.gid; msg.Style = ms; msg.MessageObjectType = MessageActorType.EntGroup; if (this.IsNotifyFlashing(msg)) { if (this.IsShieldMessage(msg)) { INWindow inWindow = this.dataService.INWindow as INWindow; if (inWindow != null) { ItemGroup group = inWindow.Employee.listEntGroup.FindItemGroup(msg.Gid); if (group != null) { group.AddMessageCache(msg); group.UpdateShieldCount(); } } } else { NotifyIconUtil.Instance.SetFlashIcon(FlashIconType.EntGroup); NotifyIconUtil.Instance.StartFlashing(); this.dataModel.AddMessage(msg.Gid, MessageActorType.EntGroup, msg); if (this.IsAddMessageBox()) { MessageBoxWindow mbw = this.dataModel.GetMessageBox(); if (mbw == null) { mbw = new MessageBoxWindow(); this.dataModel.SetMessageBox(mbw); } mbw.Refresh(); mbw.Show(); } } } else { this.GroupAddMessage(msg); } } } catch (System.Exception ex) { ServiceUtil.Instance.Logger.Error(ex.ToString()); } }