private async Task <List <Wishlist> > LoadData(IPlayniteAPI PlayniteApi, string PluginUserDataPath, IsThereAnyDealSettings settings, string PlainSelected = "")
        {
            //logger.Debug("LoadData");
            IsThereAnyDealApi isThereAnyDealApi = new IsThereAnyDealApi();
            List <Wishlist>   ListWishlist      = isThereAnyDealApi.LoadWishlist(plugin, PlayniteApi, settings, PluginUserDataPath);

            return(ListWishlist);
        }
コード例 #2
0
        public override void OnApplicationStarted()
        {
            // Add code to be executed when Playnite is initialized.

            Task taskNotifications = Task.Run(() =>
            {
                IsThereAnyDealApi isThereAnyDealApi = new IsThereAnyDealApi();

                if (settings.EnableNotification)
                {
                    List <Wishlist> ListWishlist = isThereAnyDealApi.LoadWishlist(this, PlayniteApi, settings, this.GetPluginUserDataPath(), true);
                    foreach (Wishlist wishlist in ListWishlist)
                    {
                        if (wishlist.GetNotification(settings.LimitNotification))
                        {
                            PlayniteApi.Notifications.Add(new NotificationMessage(
                                                              $"IsThereAnyDeal-{wishlist.Plain}",
                                                              string.Format(resources.GetString("LOCItadNotification"),
                                                                            wishlist.Name, wishlist.ItadBestPrice.PriceNew, wishlist.ItadBestPrice.CurrencySign, wishlist.ItadBestPrice.PriceCut),
                                                              NotificationType.Info,
                                                              () => new IsThereAnyDealView(this, PlayniteApi, this.GetPluginUserDataPath(), settings, wishlist.Plain).ShowDialog()
                                                              ));
                        }
                    }
                }

                if (settings.EnableNotificationGiveaways)
                {
                    List <ItadGiveaway> itadGiveaways = isThereAnyDealApi.GetGiveaways(PlayniteApi, this.GetPluginUserDataPath());
                    foreach (ItadGiveaway itadGiveaway in itadGiveaways)
                    {
                        if (!itadGiveaway.HasSeen)
                        {
                            PlayniteApi.Notifications.Add(new NotificationMessage(
                                                              $"IsThereAnyDeal-{itadGiveaway.Title}",
                                                              string.Format(resources.GetString("LOCItadNotificationGiveaway"), itadGiveaway.TitleAll, itadGiveaway.Count),
                                                              NotificationType.Info,
                                                              () => Process.Start(itadGiveaway.Link)
                                                              ));
                        }
                    }
                }
            });
        }