public static void NotifyComingInstallation() { var enforcemets = SqlCe.GetPendingSchedules(); var validToToast = enforcemets.Where(x => x.EnforcementTime < DateTime.Today.AddDays(2)).First(); // Construct the visuals of the toast var toastContent = new ToastContent() { // Arguments when the user taps body of toast Launch = new QueryString() { { "action", "ok" }, { "appidrevision", $"close" }, }.ToString(), Visual = new ToastVisual() { BindingGeneric = new ToastBindingGeneric() { Children = { new AdaptiveText() { Text = "Reminder", }, new AdaptiveText() { Text = $"You have an upcomming scheduled installation at '{validToToast.EnforcementTime}'", }, }, }, }, }; var doc = new XmlDocument(); doc.LoadXml(toastContent.GetContent()); // And create the toast notification var toast = new ToastNotification(doc) { ExpirationTime = DateTimeOffset.Now.AddSeconds(15) }; // And then show it DesktopNotificationManagerCompat.CreateToastNotifier().Show(toast); }
public static void NotifySupInstallationStart() { // Construct the visuals of the toast var toastContent = new ToastContent() { // Arguments when the user taps body of toast Launch = new QueryString() { { "action", "ok" }, { "appidrevision", $"close" }, }.ToString(), Visual = new ToastVisual() { BindingGeneric = new ToastBindingGeneric() { Children = { new AdaptiveText() { Text = _settings.ToastNotifySupInstallationStartSettings.Title, }, new AdaptiveText() { Text = _settings.ToastNotifySupInstallationStartSettings.SubText, }, }, }, }, Scenario = (ToastScenario)_settings.ToastNotifySupInstallationStartSettings.ToastScenario, }; var doc = new XmlDocument(); doc.LoadXml(toastContent.GetContent()); // And create the toast notification var toast = new ToastNotification(doc) { ExpirationTime = DateTimeOffset.Now.AddSeconds(_settings.ToastNotifySupInstallationStartSettings.Duration) }; // And then show it DesktopNotificationManagerCompat.CreateToastNotifier().Show(toast); }
public static void NotifyNewApplication() { // Construct the visuals of the toast var toastContent = new ToastContent() { // Arguments when the user taps body of toast Launch = new QueryString() { { "action", "ok" }, { "appidrevision", $"newapp" }, }.ToString(), Visual = new ToastVisual() { BindingGeneric = new ToastBindingGeneric() { Children = { new AdaptiveText() { Text = _settings.ToastNotifyNewApplicationSettings.Title, }, new AdaptiveText() { Text = _settings.ToastNotifyNewApplicationSettings.SubText, }, }, }, }, Actions = new ToastActionsCustom() { Buttons = { // Note that there's no reason to specify background activation, since our COM // activator decides whether to process in background or launch foreground window new ToastButton(_settings.ToastNotifyNewApplicationSettings.BtSchedule, new QueryString() { { "action", "schedule" }, { "appidrevision", $"newapp" }, }.ToString()), new ToastButton(_settings.ToastNotifyNewApplicationSettings.BtPostpone, new QueryString() { { "action", "postpone" }, { "appidrevision", $"newapp" }, }.ToString()), }, }, Scenario = (ToastScenario)_settings.ToastNotifyNewApplicationSettings.ToastScenario, }; var doc = new XmlDocument(); doc.LoadXml(toastContent.GetContent()); // And create the toast notification var toast = new ToastNotification(doc) { ExpirationTime = DateTimeOffset.Now.AddSeconds(_settings.ToastNotifyNewApplicationSettings.Duration) }; // And then show it DesktopNotificationManagerCompat.CreateToastNotifier().Show(toast); }