private void ChatOnNewMessage(object sender, EngagementActivity e) { if (!Dispatcher.CheckAccess()) // Only run with dispatcher { Dispatcher.Invoke(new Action(() => ChatOnNewMessage(sender, e))); return; } // Only run event handler if the dispatcher is not shutting down. if (!Dispatcher.HasShutdownStarted) { ChatPanelViewer.ScrollToBottom(); if (_lastMessage.Day != DateTime.Now.Day) { Logger.Debug("Rolling over into new day, adjusting times in " + _engagementWindow.Engagement.SecondParty.Party.Username); // This is to make sure that all the items 'friendly dates' remain correct on midnight rollover ChatPanel.Items.Refresh(); } _lastMessage = DateTime.Now; } }
public void OnActivity(EngagementActivity args) { args.Engagement.ActivityOccured(args); if (_appContext.IsShuttingDown) return; EngagementActivityEvent handler = NewActivity; if (handler != null) handler(this, args); }
public void ActivityOccured(EngagementActivity args) { IsUnread = true; Interactions.CurrentOrNewInteraction.RecordActivity(args); }
internal void RecordActivity(EngagementActivity activity) { Activities.Add(activity); LastActivity = DateTime.Now; Logger.Debug("[" + Id + "] Recorded activity " + activity); }
/// <summary> /// Called if there is new activity on an engagement, so we can prompt the user /// </summary> /// <param name="sender">sender</param> /// <param name="args">what is the activity</param> internal void EngagementManagerOnNewActivity(object sender, EngagementActivity args) { if (_appContext.IsShuttingDown) return; Show(); RefreshRosters(); }