private async void SharpWindow_Loaded(object sender, RoutedEventArgs e) { IsExitEnabled = false; ProgressManager.downloadProg.ProgressChanged += (send, progressPercentage) => { downloadBar.Value = progressPercentage; percBlock.Text = progressPercentage.ToString() + "%"; descBlock.Text = ProgressManager.progressDescription; }; await SwiftUpdate.DownloadUpdate(downloadBar, percBlock, descBlock); }
//The Window_Loaded event is resposible for checking all working folder directories and contents to ensure they are valid //This includes checking the install path in path.xml as well as ensuring we a have good working folder structure and populating the UI Comboboxes private async void SharpWindow_Loaded(object sender, RoutedEventArgs e) { XML.Check(); XML.ReadGamePath(); XML.ReadSettingsXML(); if (await SwiftUpdate.CheckForUpdates("Underlauncher", "http://apps.sgcsam.com/Underlauncher/")) { Dictionary <Characters, string> messageDict = new Dictionary <Characters, string>() { { Characters.Alphys, "H-h-hey, so an update is r-r-ready for Underlauncher. Want to download it?" }, { Characters.Asgore, "Greetings human, it appears that an update is available for Underlauncher. Shall we download it?" }, { Characters.Asriel, "Howdy! Looks like there's an update available for Underlauncher. Want to download it?" }, { Characters.Flowey, "HEY. IDIOT. There's an update available to Underlauncher. Can we just download it already?" }, { Characters.Papyrus, "NYEH, HUMAN! I BRING NEWS! AN UPDATE IS AVAILABLE FOR UNDERLAUNCHER. WANT TO DOWNLOAD IT?" }, { Characters.Sans, "heya buddy. it looks like there's an update for underlauncher. want to download it?" }, { Characters.Toriel, "Excuse me child, but an update is available for Underlauncher. Shall we download it?" }, { Characters.Undyne, "HEY PUNK! Looks like there's an update available for Underlauncher. LET'S DOWNLOAD IT!" }, { Characters.None, "An update is available for Underlauncher. Do you want to download it?" } }; if (UTMessageBox.Show(messageDict, Constants.CharacterReactions.Normal, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { Hide(); UpdateWindow updateWindow = new UpdateWindow(); updateWindow.ShowDialog(); Show(); } } if (FileOperations.goodFolderIntegrity()) { directoryBlock.Text = "Path: " + XML.GetGamePath(); directoryBlock.ToolTip = XML.GetGamePath(); versionBlock.Text = "Version: " + Constants.GameVersion + ", Dog Check DISABLED."; browseButton.IsEnabled = false; saveEditorButton.IsEnabled = true; musicEditorButton.IsEnabled = true; optionsButton.IsEnabled = true; savesCombo.IsEnabled = true; presetsCombo.IsEnabled = true; debugCheck.IsEnabled = true; launchButton.IsEnabled = true; populateSavesCombo(); populatePresetsCombo(); } }
private void cancelButton_Click(object sender, RoutedEventArgs e) { SwiftUpdate.AbortDownload(); Close(); }