From a4a97f7b99d18ab49df44e0fff4265380c78d35f Mon Sep 17 00:00:00 2001 From: fyr77 Date: Mon, 26 Feb 2024 20:02:16 +0100 Subject: [PATCH] finalize download check --- EnvyUpdate/DashboardPage.xaml.cs | 16 +++++++++------- EnvyUpdate/GlobalVars.cs | 1 + EnvyUpdate/Properties/Resources.Designer.cs | 9 +++++++++ EnvyUpdate/Properties/Resources.de.resx | 3 +++ EnvyUpdate/Properties/Resources.resx | 3 +++ EnvyUpdate/SettingsPage.xaml.cs | 7 +++++++ 6 files changed, 32 insertions(+), 7 deletions(-) diff --git a/EnvyUpdate/DashboardPage.xaml.cs b/EnvyUpdate/DashboardPage.xaml.cs index 1dfbc68..f53ef42 100644 --- a/EnvyUpdate/DashboardPage.xaml.cs +++ b/EnvyUpdate/DashboardPage.xaml.cs @@ -22,7 +22,6 @@ namespace EnvyUpdate private string gpuURL = null; private string skippedVer = null; private DateTime lastFileChanged = DateTime.MinValue; - private bool isDownloading = false; public DashboardPage() { @@ -213,8 +212,11 @@ namespace EnvyUpdate { if (GlobalVars.autoDownload) { - Debug.LogToFile("INFO Auto-Downloading driver."); - buttonDownload_Click(null, null); + if (buttonDownload.IsVisible) + { + Debug.LogToFile("INFO Auto-Downloading driver."); + buttonDownload_Click(null, null); + } } Debug.LogToFile("INFO Showing update popup notification."); @@ -347,16 +349,16 @@ namespace EnvyUpdate private void buttonDownload_Click(object sender, RoutedEventArgs e) { - if (isDownloading) + if (GlobalVars.isDownloading) { Debug.LogToFile("WARN A download is already running."); - ShowSnackbar(Wpf.Ui.Common.ControlAppearance.Danger, Wpf.Ui.Common.SymbolRegular.ErrorCircle24, Properties.Resources.info_install_complete, Properties.Resources.info_install_complete_title); + ShowSnackbar(Wpf.Ui.Common.ControlAppearance.Danger, Wpf.Ui.Common.SymbolRegular.ErrorCircle24, Properties.Resources.info_download_running, Properties.Resources.info_download_running_title); } else { progressbarDownload.Visibility = Visibility.Visible; buttonDownload.IsEnabled = false; - isDownloading = true; + GlobalVars.isDownloading = true; if (File.Exists(Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe.downloading"))) { @@ -392,7 +394,7 @@ namespace EnvyUpdate Application.Current.Dispatcher.Invoke(new Action(() => { buttonDownload.IsEnabled = true; progressbarDownload.Visibility = Visibility.Collapsed; - isDownloading = false; + GlobalVars.isDownloading = false; })); if (e.Error == null) { diff --git a/EnvyUpdate/GlobalVars.cs b/EnvyUpdate/GlobalVars.cs index b56e851..f52b4af 100644 --- a/EnvyUpdate/GlobalVars.cs +++ b/EnvyUpdate/GlobalVars.cs @@ -20,5 +20,6 @@ namespace EnvyUpdate public static bool useAppdata = false; public static bool hasWrite = true; public static bool autoDownload = false; + public static bool isDownloading = false; } } diff --git a/EnvyUpdate/Properties/Resources.Designer.cs b/EnvyUpdate/Properties/Resources.Designer.cs index feea38c..466a9c0 100644 --- a/EnvyUpdate/Properties/Resources.Designer.cs +++ b/EnvyUpdate/Properties/Resources.Designer.cs @@ -114,6 +114,15 @@ namespace EnvyUpdate.Properties { } } + /// + /// Looks up a localized string similar to Download running. + /// + public static string info_download_running_title { + get { + return ResourceManager.GetString("info_download_running_title", resourceCulture); + } + } + /// /// Looks up a localized string similar to Driver installer successfully downloaded.. /// diff --git a/EnvyUpdate/Properties/Resources.de.resx b/EnvyUpdate/Properties/Resources.de.resx index 96ebd90..b5a18f5 100644 --- a/EnvyUpdate/Properties/Resources.de.resx +++ b/EnvyUpdate/Properties/Resources.de.resx @@ -135,6 +135,9 @@ Ein Downloadvorgang läuft bereits! + + Download läuft + Treiber-Installationsdatei erfolgreich heruntergeladen. diff --git a/EnvyUpdate/Properties/Resources.resx b/EnvyUpdate/Properties/Resources.resx index f003fa4..2623dae 100644 --- a/EnvyUpdate/Properties/Resources.resx +++ b/EnvyUpdate/Properties/Resources.resx @@ -135,6 +135,9 @@ A download process is already running! + + Download running + Driver installer successfully downloaded. diff --git a/EnvyUpdate/SettingsPage.xaml.cs b/EnvyUpdate/SettingsPage.xaml.cs index 1aa8e7f..e65aa94 100644 --- a/EnvyUpdate/SettingsPage.xaml.cs +++ b/EnvyUpdate/SettingsPage.xaml.cs @@ -33,6 +33,13 @@ namespace EnvyUpdate if (GlobalVars.autoDownload) chkAutodl.IsChecked = true; + if (GlobalVars.isDownloading) + { + chkAppdata.IsEnabled = false; + } + else + chkAppdata.IsEnabled = true; + textBoxLicEnvyupdate.Text = Properties.Licenses.EnvyUpdate; textBoxLicFody.Text = Properties.Licenses.Fody; textBoxLicCostura.Text = Properties.Licenses.CosturaFody;