private void OnEventRegistered(object o, EventDescriptionEventArgs e) { if (e.EventDescription == null || !Setting.Instance.NotificationProperty.IsEnabledNotificationBar) return; switch (e.EventDescription.Kind) { case EventKind.DirectMessage: if (!Setting.Instance.NotificationProperty.NotifyDmEvent) return; break; case EventKind.Favorite: case EventKind.Unfavorite: if (!Setting.Instance.NotificationProperty.NotifyFavoriteEvent) return; break; case EventKind.Mention: if (!Setting.Instance.NotificationProperty.NotifyMentionEvent) return; break; case EventKind.Retweet: if (!Setting.Instance.NotificationProperty.NotifyRetweetEvent) return; break; case EventKind.Follow: if (!Setting.Instance.NotificationProperty.NotifyFollowEvent) return; break; } var nivm = new NotificationItemViewModel(e.EventDescription); nivm.RequireClose += (no, ne) => _notifications.Remove(nivm); _notifications.Add(nivm); Task.Factory.StartNew(() => Thread.Sleep(Setting.Instance.ExperienceProperty.TwitterActionNotifyShowLength)) .ContinueWith(_ => { try { _notifications.Remove(nivm); } catch { } }); }
private static void OnEventRegistered(EventDescriptionEventArgs e) { var threadSafeHandler = Interlocked.CompareExchange(ref EventRegistered, null, null); if (threadSafeHandler != null) { threadSafeHandler(null, e); } EventRegisteredEvent.Raise(e); }
private static void OnEventRegistered(EventDescriptionEventArgs e) { var threadSafeHandler = Interlocked.CompareExchange(ref EventRegistered, null, null); if (threadSafeHandler != null) threadSafeHandler(null, e); EventRegisteredEvent.Raise(e); }
private static void EventStorage_EventRegistered(object sender, EventDescriptionEventArgs e) { switch (e.EventDescription.Kind) { case EventKind.Favorite: if (Setting.Instance.NotificationProperty.NotifyFavorite) IssueNotification( e.EventDescription.SourceUser, e.EventDescription.TargetUser, e.EventDescription.TargetTweet.Text, EventKind.Favorite); break; case EventKind.Follow: if (Setting.Instance.NotificationProperty.NotifyFollow) IssueNotification( e.EventDescription.SourceUser, e.EventDescription.TargetUser, e.EventDescription.SourceUser.TwitterUser.Bio, EventKind.Follow); break; case EventKind.Mention: if (Setting.Instance.NotificationProperty.NotifyMention) IssueNotification( e.EventDescription.SourceUser, e.EventDescription.TargetUser, e.EventDescription.TargetTweet.Text, EventKind.Mention); break; case EventKind.Retweet: if (Setting.Instance.NotificationProperty.NotifyRetweet) IssueNotification( e.EventDescription.SourceUser, e.EventDescription.TargetUser, e.EventDescription.TargetTweet.Text, EventKind.Retweet); break; case EventKind.Unfavorite: if (Setting.Instance.NotificationProperty.NotifyFavorite) IssueNotification( e.EventDescription.SourceUser, e.EventDescription.TargetUser, e.EventDescription.TargetTweet.Text, EventKind.Unfavorite); break; } }
private static void RaiseNotificationEvent(object sender, EventDescriptionEventArgs e) { if (Setting.Instance.StateProperty.IsInSilentMode) return; if (NotificationEvent == null) return; NotificationEvent(sender, e); }