private static INotificationsLifetimeSupervisor CreateLifetimeSupervisor(NotificationLifetimeType lifetime) { if (lifetime == NotificationLifetimeType.Basic) { return(new CountBasedLifetimeSupervisor(MaximumNotificationCount.FromCount(5))); } return(new TimeAndCountBasedLifetimeSupervisor(TimeSpan.FromSeconds(5), MaximumNotificationCount.UnlimitedNotifications())); }
public Notifier CreateNotifier(Corner corner, PositionProviderType relation, NotificationLifetimeType lifetime) { _notifier?.Dispose(); _notifier = null; return(new Notifier(cfg => { cfg.PositionProvider = CreatePositionProvider(corner, relation); cfg.LifetimeSupervisor = CreateLifetimeSupervisor(lifetime); cfg.Dispatcher = Dispatcher.CurrentDispatcher; })); }
public void ChangePosition(Corner corner, PositionProviderType relation, NotificationLifetimeType lifetime) { _notifier = CreateNotifier(corner, relation, lifetime); }
private Notifier CreateNotifier(Corner corner, PositionProviderType relation, NotificationLifetimeType lifetime) { mNotifier?.Dispose(); mNotifier = null; return(new Notifier(cfg => { cfg.PositionProvider = CreatePositionProvider(corner, relation); cfg.LifetimeSupervisor = CreateLifetimeSupervisor(lifetime); cfg.Dispatcher = Dispatcher.CurrentDispatcher; cfg.DisplayOptions.TopMost = TopMost.GetValueOrDefault(); })); }