public ScheduledToastNotification GetNotification(string userId, string name) { var title = String.Concat("Good Morning ", name); var content = "Don't forget to check out your daily goals!"; var notificationContent = _builder.Build(title, content); var notification = new ScheduledToastNotification(notificationContent.GetXml(), DateTime.Today.AddHours(NotificationTimes.NextMorning)); notification.Tag = "Morning"; return(notification); }
/// <summary> /// Send a notification to each device in the list. /// </summary> /// <param name="notification">The notification to send.</param> /// <param name="devices">The list of devices to which send the notification.</param> public void Send(INotification notification, IEnumerable <IDevice> devices) { NotificationBuildersFactory buildersFactory = NotificationBuildersFactory.Instance; INotificationBuilder builder = buildersFactory.Create(notification.Builder); NotificationPayload payload = builder.Build(notification); INotificationService notificationService; foreach (IDevice device in devices) { notificationService = NotificationServiceFactory.Make(device.Type, certificatePath, certificatePassword, senderId, senderAuthToken); if (notificationService != null) { notificationService.Send(payload, device); device.Notified(notification); } } }
public ScheduledToastNotification GetNotification(string userId, string name) { var comparisonMessage = GetComparisonMessage(userId); if (comparisonMessage == null) { return(null); } var title = String.Concat("Good work ", name, "!"); var content = String.Concat("You ", comparisonMessage, " of players your age. That's awesome! Keep it up!"); var notificationContent = _builder.Build(title, content); var notification = new ScheduledToastNotification(notificationContent.GetXml(), DateTime.Now.AddMinutes(NotificationTimes.ComparisonMinutes)); notification.Tag = "Comparison"; return(notification); }
public ScheduledToastNotification GetNotification(string userId, string name) { var balance = _balanceHandler.GetBalance(userId); if (balance <= 0) { return(null); } var title = String.Concat(name, " dont't Forget!"); var content = "You still have crystals waiting for you!"; var notificationContent = _builder.Build(title, content); var notification = new ScheduledToastNotification(notificationContent.GetXml(), NotificationTimes.GetTimeToNotify(NotificationTimes.CrystalsHour)); notification.Tag = "Crystals"; return(notification); }
INotification IBuilder.Build() => builder.Build();