} // End exitButtonClicked private async void MenuItemUpdateCache_Click(object sender, RoutedEventArgs e) { try { MenuItemUpdateCache.IsEnabled = false; statusBar1TextBlock.Text = "Started Cache Update"; Progress <taskProgressMsg> progressMessages = new Progress <taskProgressMsg>(updateForTaskProgress); // Will contain the progress messages from each function. if (System.IO.File.Exists("completeAddonList.json")) { tosAMProgramSettings.previousUpdateDateStampUTC = new System.IO.FileInfo("completeAddonList.json").LastWriteTimeUtc; } else { tosAMProgramSettings.previousUpdateDateStampUTC = DateTime.MinValue; } // Store previous update time for "What's new" option. repoCacheManagement rCM = new repoCacheManagement() { rootDir = tosAMProgramSettings.tosRootDir, webConnector = webConnector }; List <addonDataFromRepo> iToSCollections = await rCM.callParentUpdateCache(progressMessages, 0); // iToS iToSCollections.Select(x => { x.whichRepo = "iToS"; return(x); }).ToList(); List <addonDataFromRepo> jToSCollections = await rCM.callParentUpdateCache(progressMessages, 1); // jToS jToSCollections.Select(x => { x.whichRepo = "jToS"; return(x); }).ToList(); listOfBrokenAddons = await rCM.returnBrokenAddonData(progressMessages); // Download list of broken addons. listOfAddonOverrides = await rCM.returnAddonInstallerOverride(progressMessages); // Return manually-maintained list of addon overrides. listOfAllAddons.Clear(); listOfAllAddons = iToSCollections.Concat(jToSCollections).ToList(); saveCacheDataToFile(true, progressMessages); statusBar1TextBlock.Text = "Completed all Cache Update functions."; displayActiveGrid(); // Update the active tab. } catch (Exception ex) { Common.showError("Update Cache Error", ex); } finally { MenuItemUpdateCache.IsEnabled = true; } } // End MenuItemUpdateCache_Click
} // end MenuItemSelectToSDir_Click private async void MenuItemUpdateDeps_Click(object sender, RoutedEventArgs e) { try { if (Common.checkForToSDirectory(tosAMProgramSettings.tosRootDir) == false) { MessageBox.Show("Please set a valid ToS Program directory."); return; } statusBar1TextBlock.Text = "Starting Dependency download functions."; Progress <taskProgressMsg> progressMessages = new Progress <taskProgressMsg>(updateForTaskProgress); // Will contain the progress messages from each function. repoCacheManagement rCM = new repoCacheManagement() { rootDir = tosAMProgramSettings.tosRootDir, webConnector = webConnector }; await rCM.checkAndInstallDependencies(progressMessages); // Dependencies - does not care about return values. statusBar1TextBlock.Text = "Completed Dependency download functions."; } catch (Exception ex) { Common.showError("Update Dependency Error", ex); } } // end MenuItemUpdateDeps_Click