private void SettingsWindow_Closing(object?sender, System.ComponentModel.CancelEventArgs e) { //don't close the window, only hide it e.Cancel = true; //activate the mainwindow before hiding the settingswindow PV_MainWindow.Activate(); //hide the settings window this.Hide(); }
private async void CheckUpdatesBtn_Click(object?sender, global::Avalonia.Interactivity.RoutedEventArgs e) { //check for updates if there is an intenet connection if (PV_CheckForInternetConnection() == true) { if (PV_CheckForUpdates() == true) { //show a contentdialog to prompt the user to update ContentDialog UpdateDialog = new ContentDialog(); UpdateDialog.Title = "Update available"; UpdateDialog.Content = "An update is available, would you like to download it?"; UpdateDialog.PrimaryButtonText = " Yes "; UpdateDialog.CloseButtonText = " No "; UpdateDialog.DefaultButton = ContentDialogButton.Primary; ContentDialogResult result = await UpdateDialog.ShowAsync(); if (result == ContentDialogResult.Primary) { //navigate to the update page and shutdown the application PV_OpenBrowser("https://www.github.com/Apollo199999999/LauncherX/releases"); this.Close(); if (PV_MainWindow != null) { PV_MainWindow.Close(); } } } else if (PV_CheckForUpdates() == false) { //show a contentdialog to show that there are no updates available ContentDialog NoUpdateDialog = new ContentDialog(); NoUpdateDialog.Title = "You're up to date!"; NoUpdateDialog.Content = "No updates are available for LauncherX"; NoUpdateDialog.CloseButtonText = " OK "; NoUpdateDialog.DefaultButton = ContentDialogButton.Close; ContentDialogResult result = await NoUpdateDialog.ShowAsync(); } } else if (PV_CheckForInternetConnection() == false) { //no internet conntection available, show an error message ContentDialog NoInternetDialog = new ContentDialog(); NoInternetDialog.Title = "No internet connection"; NoInternetDialog.Content = "LauncherX cannot check for updates as there is no internet connection. " + "Connect to the internet and try again";; NoInternetDialog.CloseButtonText = " OK "; NoInternetDialog.DefaultButton = ContentDialogButton.Close; ContentDialogResult result = await NoInternetDialog.ShowAsync(); } }