public void CloseAnim() { this.Dispatcher.Invoke(() => { ThicknessAnimationUsingKeyFrames close = new ThicknessAnimationUsingKeyFrames(); close.KeyFrames.Add(new SplineThicknessKeyFrame(new Thickness(StartingThickness, 0, 0, 0), TimeSpan.FromMilliseconds(300), new KeySpline(.5, 0, .3, 1))); close.Completed += (s, o) => { NotificationHolder.BeginAnimation(Grid.MarginProperty, null); Hide(); ni.SetDelivered(); NotificationProvider.deliveredNotifications.Add(ni); NotificationProvider.NQ.Remove(ni); NotificationProvider.NQ.SetBusyToFalseOnEnd(); }; NotificationHolder.BeginAnimation(Grid.MarginProperty, close); }); }
public void AddOrUpdateNotification(NotificationModel model) { if (model.ID == 0) { // if theres nothing in the dictionary just set first key to 100 int newKey = _notifications.Count > 0 ? _notifications.Keys.Max() + HolderGap : 100; model.ID = newKey; NotificationHolder holder = new NotificationHolder(); var keys = holder.CalculateNotificationTimes(newKey, model, DaysToGenerate); _notifications.Add(newKey, holder); foreach (KeyValuePair <int, DateTime> timeSets in keys) { //Todo: create your own implementation of this. //CrossLocalNotifications.Current.Show($"Time to log your {model.LogType}!", model.Message, // timeSets.Key, timeSets.Value); } } else { NotificationHolder holder = _notifications[model.ID]; foreach (int key in holder.SystemKeys.Keys) { //Todo: create your own implementation of this. //CrossLocalNotifications.Current.Cancel(key); } foreach (KeyValuePair <int, DateTime> timeSets in holder.SystemKeys) { //Todo: create your own implementation of this. //CrossLocalNotifications.Current.Show($"Time to log your {model.LogType}!", // model.Message, timeSets.Key, timeSets.Value); } } Save(); }
public void Pop(NotificationInfo Ni) { ni = Ni; if (ni.Right) { NotificationHolder.Margin = new Thickness { Left = 220, Top = 0, Right = 0, Bottom = 0 }; Left = SystemParameters.FullPrimaryScreenWidth - 200; StartingThickness = 200; EndThickness = 0; } else { NotificationHolder.Margin = new Thickness { Left = -200, Top = 0, Right = 0, Bottom = 0 }; Left = 0; StartingThickness = -200; EndThickness = 0; } this.Dispatcher.Invoke(() => { ThicknessAnimationUsingKeyFrames open = new ThicknessAnimationUsingKeyFrames(); open.KeyFrames.Add(new SplineThicknessKeyFrame(new Thickness(EndThickness), TimeSpan.FromMilliseconds(300), new KeySpline(.5, 0, .3, 1))); NotificationHolder.BeginAnimation(Grid.MarginProperty, open); if (TCTData.Settings.NotificationSound) { if (ni.Sound) { System.Media.SoundPlayer sp = new System.Media.SoundPlayer(Environment.CurrentDirectory + "\\content\\served.wav"); sp.Load(); sp.Play(); } } }); }
public void Init() { _notification = new NotificationModel() { ReminderTimes = new List <TimeSpan>() { new TimeSpan(hours: 8, minutes: 30, seconds: 0), new TimeSpan(hours: 10, minutes: 30, seconds: 0), new TimeSpan(hours: 13, minutes: 20, seconds: 2), new TimeSpan(hours: 18, minutes: 30, seconds: 0), } }; _periodicNotification = new NotificationModel() { Interval = new TimeSpan(hours: periodicIntervalHour, minutes: periodicIntervalMinute, seconds: 0), StartTime = new TimeSpan(hours: periodicStartHour, minutes: periodicStartMinute, seconds: 0), EndTime = new TimeSpan(hours: periodicEndHour, minutes: periodicEndMinute, seconds: 0), IsPeriodic = true }; _periodicNotificationHolder = new NotificationHolder(); _notificationHolder = new NotificationHolder(); }
public void Cleanup() { _notificationHolder = null; }