Ejemplo n.º 1
0
        private static INotificationsLifetimeSupervisor CreateLifetimeSupervisor(NotificationLifetimeType lifetime)
        {
            if (lifetime == NotificationLifetimeType.Basic)
            {
                return(new CountBasedLifetimeSupervisor(MaximumNotificationCount.FromCount(5)));
            }

            return(new TimeAndCountBasedLifetimeSupervisor(TimeSpan.FromSeconds(5), MaximumNotificationCount.UnlimitedNotifications()));
        }
Ejemplo n.º 2
0
        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;
            }));
        }
Ejemplo n.º 3
0
 public void ChangePosition(Corner corner, PositionProviderType relation, NotificationLifetimeType lifetime)
 {
     _notifier = CreateNotifier(corner, relation, lifetime);
 }
Ejemplo n.º 4
0
        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();
            }));
        }