示例#1
0
        private async Task LoadCache()
        {
            Progress.IsIndeterminate = false;
            Progress.Value           = 0;
            Status.Text       = Text.Loading;
            Cancel.Visibility = Visibility.Hidden;
            Hint.Visibility   = Visibility.Visible;

            WebCache.Init();
            if (WebCache.CacheGameVersion != await Riot.GetLatestVersionAsync() ||
                WebCache.CacheLocale != CultureInfo.CurrentCulture.Name)
            {
                LogTo.Info("Clearing web cache due to a new LoL version being available, or a language change");
                WebCache.Clear();

                WebCache.CacheGameVersion = await Riot.GetLatestVersionAsync();

                WebCache.CacheLocale = CultureInfo.CurrentCulture.Name;
            }

            Riot.SetLanguage(Config.Current.Culture);
            await Riot.CacheAllAsync(o => Dispatcher.Invoke(() => Progress.Value = o * 0.7));

            await TeamGuesser.Load(new Progress <float>(o => Dispatcher.Invoke(() => Progress.Value = 0.7 + (o * 0.3))));
        }