private async Task <List <ItadGiveaway> > LoadDatatGiveaways(IPlayniteAPI PlayniteApi, string PluginUserDataPath) { //logger.Debug("LoadData"); IsThereAnyDealApi isThereAnyDealApi = new IsThereAnyDealApi(); List <ItadGiveaway> itadGiveaways = isThereAnyDealApi.GetGiveaways(PlayniteApi, PluginUserDataPath); return(itadGiveaways); }
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) )); } } } }); }