Beispiel #1
0
        public NotifyControl(NotificationOption notificationOption, ObservableCollection <NotificationOption> baseCollection)
        {
            _baseCollection = baseCollection;
            InitializeComponent();
            DataContext = notificationOption;
            ViewModel   = notificationOption;

            if (notificationOption.IsEmpty)
            {
                _baseCollection.Remove(notificationOption);
                this.Visibility = Visibility.Collapsed;
                return;
            }

            if (notificationOption.Level == NotificationOption.NotificationLevel.Alert &&
                notificationOption.FadeoutTime > TimeSpan.FromSeconds(1))
            {
                _timer = new Timer(obj =>
                {
                    Dispatcher.Invoke(TriggerHide);
                    _timer?.Dispose();
                }, null, (int)notificationOption.FadeoutTime.TotalMilliseconds, Timeout.Infinite);
            }
        }
Beispiel #2
0
 public static void Push(NotificationOption notification)
 {
     Execute.ToUiThread(() => { NotificationList?.Add(notification); });
 }