public async Task <bool> IsValid(string key) { var name = typeof(T).Name; if (EveCache.Cache.Contains(name)) { return(!Network.HasInternetConnection || await EveUtils.GetServerStatusAsync() != EveServerStatus.Online || EveCache.Cache[name].CachedUntil.ToLocalTime() > DateTime.Now); } return(!Network.HasInternetConnection || await EveUtils.GetServerStatusAsync() != EveServerStatus.Online); }
public override async Task <bool> IsValid(string key) { var filename = key + ".cache"; if (await ApplicationData.Current.LocalFolder.ExistsAsync(filename)) { var file = await ApplicationData.Current.LocalFolder.GetFileAsync(filename); return(!Network.HasInternetConnection || await EveUtils.GetServerStatusAsync() != EveServerStatus.Online || (await file.GetDateModifiedAsync()).ToLocalTime().AddMinutes(5.0) > DateTime.Now); } return(true); }
private async void InitializeComponent() { await this.RunDispatcherAsync(async() => { var item = this.eveApi.StaticData.GetItemType(this.ItemId); this.Description = EveUtils.XAMLify(item.Description); this.Name = item.Name; this.GroupName = item.GroupName; this.MarketGroupName = item.MarketGroup?.Name; this.Icon = await(await this.eveApi.GetImageAsync(ImageType.Item, this.ItemId, 1, 128)).ToBitmapImageAsync(); var marketQuicklook = await this.eveApi.GetMarketOrdersAsync(this.ItemId); this.Price = this.eveApi.GetItemPrice(this.ItemId).AdjustedPrice; this.BuyOrders = marketQuicklook.BuyOrders.Where(x => x.Security > 0.4).OrderByDescending(x => x.Price).Take(10); this.SellOrders = marketQuicklook.SellOrders.Where(x => x.Security > 0.4).OrderBy(x => x.Price).Take(10); }); }