コード例 #1
0
        public void ScheduleToast(AiringShowNotificationEntry entry)
        {
            var date = DateTime.SpecifyKind(entry.StartAirTime, DateTimeKind.Unspecified);

            date = TimeZoneInfo.ConvertTimeToUtc(date, _jstTimeZone);
            entry.StartAirTime           = date.ToLocalTime().Add(TimeSpan.FromHours(Settings.AiringNotificationOffset));
            entry.TriggeredNotifications = (DateTime.Now.Subtract(entry.StartAirTime).Days / 7) + 1;

            ResourceLocator.HandyDataStorage.RegisteredAiringNotifications.StoredItems.Add(entry);
            ResourceLocator.NotificationsTaskManager.StartTask(BgTasks.AiredNotification);
        }
コード例 #2
0
        public void ScheduleToast(AiringShowNotificationEntry entry)
        {
            var notifier = ToastNotificationManager.CreateToastNotifier();

            var date = DateTime.SpecifyKind(entry.StartAirTime, DateTimeKind.Unspecified);

            TimeZoneInfo.ConvertTime(date, _jstTimeZone, TimeZoneInfo.Utc);
            entry.StartAirTime = date.ToLocalTime().Add(TimeSpan.FromHours(Settings.AiringNotificationOffset));
            var airedEps = (DateTime.Now.Subtract(entry.StartAirTime).Days / 7) + 1;

            for (int i = airedEps; i < entry.EpisodeCount; i++)
            {
                var toast = new ScheduledToastNotification(new ToastContent
                {
                    Launch = $"https://myanimelist.net/anime/{entry.Id}",

                    Scenario = ToastScenario.Default,

                    Visual = new ToastVisual
                    {
                        BindingGeneric = new ToastBindingGeneric
                        {
                            AppLogoOverride = new ToastGenericAppLogo {
                                Source = Logo
                            },
                            HeroImage = new ToastGenericHeroImage {
                                Source = entry.ImageUrl
                            },
                            Children =
                            {
                                new AdaptiveText
                                {
                                    Text = "New anime episode is on air!"
                                },

                                new AdaptiveText
                                {
                                    Text      = $"Episode {i} of {entry.Title} has just aired!",
                                    HintStyle = AdaptiveTextStyle.Subtitle,
                                }
                            },
                        },
                    },
                }.GetXml(), new DateTimeOffset(entry.StartAirTime.Add(TimeSpan.FromDays(7 * i))),
                                                           TimeSpan.FromMinutes(5), 1)
                {
                    Tag = $"{entry.Id};ep{i}"
                };
                notifier.AddToSchedule(toast);
            }
        }
コード例 #3
0
        public void ScheduleToast(AiringShowNotificationEntry entry)
        {
            var notifier = ToastNotificationManager.CreateToastNotifier();

            //for (int i = airedEps; i < entry.EpisodeCount; i++)
            //{
            //    var toast = new ScheduledToastNotification(new ToastContent
            //            {
            //                Launch = $"https://myanimelist.net/anime/{entry.Id}",

            //                Scenario = ToastScenario.Default,

            //                Visual = new ToastVisual
            //                {
            //                    BindingGeneric = new ToastBindingGeneric
            //                    {
            //                        AppLogoOverride = new ToastGenericAppLogo {Source = Logo},
            //                        HeroImage = new ToastGenericHeroImage {Source = entry.ImageUrl},
            //                        Children =
            //                        {
            //                            new AdaptiveText
            //                            {
            //                                Text = "New anime episode is on air!"
            //                            },

            //                            new AdaptiveText
            //                            {
            //                                Text = $"Episode {i} of {entry.Title} has just aired!",
            //                                HintStyle = AdaptiveTextStyle.Subtitle,
            //                            }
            //                        },
            //                    },
            //                },
            //            }.GetXml(), new DateTimeOffset(entry.StartAirTime.Add(TimeSpan.FromDays(7 * i))),
            //            TimeSpan.FromMinutes(5), 1)
            //        {Tag = $"{entry.Id};ep{i}"};
            //    notifier.AddToSchedule(toast);
            //}
        }
コード例 #4
0
 public void ScheduleToast(AiringShowNotificationEntry entry)
 {
     ResourceLocator.HandyDataStorage.RegisteredAiringNotifications.StoredItems.Add(entry);
     ResourceLocator.NotificationsTaskManager.StartTask(BgTasks.AiredNotification);
 }