/// <summary> /// Cancel a notification with its tag /// </summary> /// <param name="tag"></param> public static void Cancel(string tag) { NotificationHandle nH = notificationHandleList.Find (x => x.Notification.NotificationTag == tag); cancel(nH); }
/// <summary> /// Launch a notification with its tag /// </summary> /// <param name="tag"></param> /// <returns></returns> public static void Notify(string tag) { NotificationHandle nH = notificationHandleList.Find (x => x.Notification.NotificationTag == tag); scheduleNotification(nH); }
/// <summary> /// Cancel a notification with its ID /// </summary> /// <param name="id"></param> public static void Cancel(int id) { NotificationHandle nH = notificationHandleList.Find (x => x.Notification.NotificationID == id); cancel(nH); }
private static void scheduleNotification(NotificationHandle nH) { Notification n = nH.Notification; // Calculate delay time TimeSpan t = n.When - DateTime.Now; int delayTime = (int)t.TotalMilliseconds; if (delayTime < 0) { delayTime = 0; } //// Set coordinate monitor //if (!hasWatcherStarted) //{ // watcher.PositionChanged += // new EventHandler< // GeoPositionChangedEventArgs<GeoCoordinate>>( // watcher_PositionChanged); // watcher.Start(); // hasWatcherStarted = true; //} // Set timer if (nH.NotificationTimer != null) { nH.NotificationTimer.Change(delayTime, n.RepeatInterval); } else { nH.NotificationTimer = new Timer(notify, nH, delayTime, n.RepeatInterval); } }
/// <summary> /// Launch a notification with its ID /// </summary> /// <param name="id"></param> /// <returns></returns> public static void Notify(int id) { NotificationHandle nH = notificationHandleList.Find (x => x.Notification.NotificationID == id); scheduleNotification(nH); }
public CaracteristicaHandle(ICaracteristicaRepository caracteristicaRepository, INotificationHandler <NotificationDomain> notifications, IMediator mediator) { _caracteristicaRepository = caracteristicaRepository; _notifications = (NotificationHandle)notifications; _mediator = mediator; }
// Push the notification private static void notify(object state) { NotificationHandle nH = (NotificationHandle)state; Notification n = nH.Notification; switch (n.NotificationType) { case NotificationTypes.Dialogue: // // To do... // break; case NotificationTypes.Snackbar: // // To do... // break; case NotificationTypes.Toast: if (nH.HasStarted == true && n.When.AddMilliseconds(n.TimeoutAfter) < DateTime.Now) { Cancel(n.NotificationID); } else { // Push a toast through popup window Application.Current.Dispatcher .BeginInvoke(DispatcherPriority.Background, new UINotificationDelegate(CreateToast), n.ContentText); // // Here, CreateToast is a temporary function defined in // UI module. The function should be redesigned along // with the UIFunctionDelegate,including its // functionality and parameters. // } break; case NotificationTypes.None: // // To do... // break; default: break; } }
private static void cancel(NotificationHandle nH) { Notification n = nH.Notification; // Stop the timer if timeout if (nH.HasStarted == true && n.When.AddMilliseconds(n.TimeoutAfter) < DateTime.Now) { if (nH.NotificationTimer != null) { nH.NotificationTimer.Change(Timeout.Infinite, Timeout.Infinite); } nH.HasStarted = false; return; } }
public BaseController(INotificationHandler <NotificationDomain> notifications) { _notifications = (NotificationHandle)notifications; }
internal static void AddNotificationToList(Notification notification) { NotificationHandle nH = new NotificationHandle(notification); notificationHandleList.Add(nH); }
public void RemoveEmployee(NotificationHandle handle) { notificatEvent -= handle; }
public void AddEmployee(NotificationHandle handle) { notificatEvent += handle; }