private void CheckToUpdateItemSets() { // For now, only check for OPGG until we support more build sources string opggVersion = OPGG.GetVersion(); string localVersion = Properties.Settings.Default.LocalItemsVersion; bool shouldUpdate = VersionUtil.ShouldUpdateItemSet(opggVersion, localVersion); if (shouldUpdate) { ShowInfoMessageBox("Outdated item sets", "Your item sets are outdated compared to current OP.GG version."); } }
private async Task ImportItemSetsAsync() { // Fetch configuration var config = new ConfigurationViewModel { ApplicationPrefixName = Properties.Settings.Default.AppPrefixName, LoLDirectory = Properties.Settings.Default.LoLDirectory, RemoveOutdatedItems = IsCheckedRemoveOutdated, ShowSkillsOrder = IsCheckedShowSkillOrders, DownloadAramBuilds = IsCheckedDownloadAramBuilds }; // Start generation if (IsCheckedSourceOPGG) { var opggGenerator = new ItemSetGenerator <OPGG>(config, Log, UpdateProgressBar); try { List <ChampionViewModel> failedChampions = await opggGenerator.GenerateItemSetForAllChampionsAsync(CancelTokenSource.Token); // Update local version with OPGG version for now Properties.Settings.Default.LocalItemsVersion = OPGG.GetVersion(); Properties.Settings.Default.Save(); string msgInfoBox = "Your item sets have been imported."; if (failedChampions.Count > 0) { msgInfoBox += "\nHowever, these champions didn't do really well:"; failedChampions.ForEach(champion => msgInfoBox += $"\n-> {champion.Name}"); } ShowInfoMessageBox("Import completed", msgInfoBox); } catch (OperationCanceledException ex) when(ex.CancellationToken == CancelTokenSource.Token) { // Log that operation has been cancelled Mouse.OverrideCursor = null; Log("Cancelled"); } finally { ToggleUIImport(); pbProgress.Value = 0; } } }
private async Task ShowAllVersionsAsync() { // TODO: Find better way to fetch version? OPGG = new OPGG(); Task <LoLStore> taskLoLStore = StoreManager <LoLStore> .GetAsync(); Task taskInitOpgg = OPGG.InitAsync("annie"); await Task.WhenAll(taskLoLStore, taskInitOpgg); // Local version string localItemsVersion = string.IsNullOrEmpty(Properties.Settings.Default.LocalItemsVersion) ? "None" : Properties.Settings.Default.LocalItemsVersion; if (grpMetadata.Visibility == Visibility.Visible) { lblLoLVersion.Content = $"LoL version: {taskLoLStore.Result.Version}"; lblOPGGVersion.Content = $"OP.GG version: {OPGG.GetVersion()}"; lblLocalItemsVersion.Content = $"Local items version: {localItemsVersion}"; } }