private static Notifier CreateNotifier(NotifyOptions opt) { return(new Notifier(cfg => { if (opt.Parent == null) { cfg.PositionProvider = new PrimaryScreenPositionProvider( (Corner)opt.Corner, opt.OffsetX, opt.OffsetY); } else { cfg.PositionProvider = new WindowPositionProvider( opt.Parent, (Corner)opt.Corner, opt.OffsetX, opt.OffsetY); } if (opt.LifeTime.TotalMilliseconds < 100) { cfg.LifetimeSupervisor = new CountBasedLifetimeSupervisor(MaximumNotificationCount.FromCount(opt.MaxCount)); } else { cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(opt.LifeTime, MaximumNotificationCount.FromCount(opt.MaxCount)); } cfg.Dispatcher = dispatcher; cfg.DisplayOptions.Width = opt.With; })); }
/// <summary> /// Создание уведомлений по настройкам /// </summary> /// <param name="opt"></param> public Notify(NotifyOptions opt) { notifier = CreateNotifier(opt); }
/// <summary> /// Настройка уведомлений на основном экране (без окна). /// </summary> /// <param name="opt">Настройки уведомлений</param> public static void SetScreenSettings(NotifyOptions opt) { notifyScreen = new Notify(opt); }