public void Start() { this.geofences.RegionStatusChanged += (sender, args) => { var exit = args.Status == GeofenceStatus.Exited; var notification = new Notification { Title = exit ? "Bye" : "Welcome", Message = exit ? $"You have left the region \"{args.Region.Identifier}\"" : $"You have entered the region \"{args.Region.Identifier}\"" }; this.notifications.Send(notification); this.notifications.Badge = this.notifications.Badge + 1; }; }
public abstract string Send(Notification notification);
public override string Send(Notification notification) { var id = Guid.NewGuid().ToString(); var soundXml = notification.Sound == null ? String.Empty : String.Format("<audio src=\"ms-appx:///Assets/{0}.wav\"/>", notification.Sound); var xmlData = String.Format(TOAST_TEMPLATE, soundXml, notification.Title, notification.Message); var xml = new XmlDocument(); xml.LoadXml(xmlData); if (notification.Date == null && notification.When == null) { var toast = new ToastNotification(xml); this.toastNotifier.Show(toast); } else { var schedule = new ScheduledToastNotification(xml, notification.SendTime) { Id = id }; this.toastNotifier.AddToSchedule(schedule); } return id; }