/// <summary> /// Show a local notification at a specified time /// </summary> /// <param name="title">Title of the notification</param> /// <param name="body">Body or description of the notification</param> /// <param name="id">Id of the notification</param> /// <param name="notifyTime">Time to show notification</param> public void Show(string title, string body, int id, DateTime notifyTime) { Notification notification = new Notification { Title = title, Content = body, Tag = id.ToString(), }; notificationId = id; Notification.IndicatorStyle style = new Notification.IndicatorStyle { SubText = body }; notification.AddStyle(style); NotificationManager.Post(notification); var time = notifyTime - DateTime.Now; int duration = (time.Seconds + time.Milliseconds / 1000); timer = new Timer(); timer.Interval = duration * 1000; timer.Elapsed += new ElapsedEventHandler(TimerElapsed); timer.Start(); }
/// <summary> /// Show a local notification /// </summary> /// <param name="title">Title of the notification</param> /// <param name="body">Body or description of the notification</param> /// <param name="id">Id of the notification</param> public void Show(string title, string body, int id = 0) { Notification notification = new Notification { Title = title, Content = body, Tag = id.ToString(), }; Notification.IndicatorStyle style = new Notification.IndicatorStyle { SubText = body }; notification.AddStyle(style); NotificationManager.Post(notification); }