Feature autodownload #44

Merged
fyr77 merged 7 commits from feature-autodownload into master 2024-02-26 20:03:05 +01:00
6 changed files with 32 additions and 7 deletions
Showing only changes of commit a4a97f7b99 - Show all commits

View file

@ -22,7 +22,6 @@ namespace EnvyUpdate
private string gpuURL = null; private string gpuURL = null;
private string skippedVer = null; private string skippedVer = null;
private DateTime lastFileChanged = DateTime.MinValue; private DateTime lastFileChanged = DateTime.MinValue;
private bool isDownloading = false;
public DashboardPage() public DashboardPage()
{ {
@ -213,8 +212,11 @@ namespace EnvyUpdate
{ {
if (GlobalVars.autoDownload) if (GlobalVars.autoDownload)
{ {
Debug.LogToFile("INFO Auto-Downloading driver."); if (buttonDownload.IsVisible)
buttonDownload_Click(null, null); {
Debug.LogToFile("INFO Auto-Downloading driver.");
buttonDownload_Click(null, null);
}
} }
Debug.LogToFile("INFO Showing update popup notification."); Debug.LogToFile("INFO Showing update popup notification.");
@ -347,16 +349,16 @@ namespace EnvyUpdate
private void buttonDownload_Click(object sender, RoutedEventArgs e) private void buttonDownload_Click(object sender, RoutedEventArgs e)
{ {
if (isDownloading) if (GlobalVars.isDownloading)
{ {
Debug.LogToFile("WARN A download is already running."); 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 else
{ {
progressbarDownload.Visibility = Visibility.Visible; progressbarDownload.Visibility = Visibility.Visible;
buttonDownload.IsEnabled = false; buttonDownload.IsEnabled = false;
isDownloading = true; GlobalVars.isDownloading = true;
if (File.Exists(Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe.downloading"))) if (File.Exists(Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe.downloading")))
{ {
@ -392,7 +394,7 @@ namespace EnvyUpdate
Application.Current.Dispatcher.Invoke(new Action(() => { Application.Current.Dispatcher.Invoke(new Action(() => {
buttonDownload.IsEnabled = true; buttonDownload.IsEnabled = true;
progressbarDownload.Visibility = Visibility.Collapsed; progressbarDownload.Visibility = Visibility.Collapsed;
isDownloading = false; GlobalVars.isDownloading = false;
})); }));
if (e.Error == null) if (e.Error == null)
{ {

View file

@ -20,5 +20,6 @@ namespace EnvyUpdate
public static bool useAppdata = false; public static bool useAppdata = false;
public static bool hasWrite = true; public static bool hasWrite = true;
public static bool autoDownload = false; public static bool autoDownload = false;
public static bool isDownloading = false;
} }
} }

View file

@ -114,6 +114,15 @@ namespace EnvyUpdate.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Download running.
/// </summary>
public static string info_download_running_title {
get {
return ResourceManager.GetString("info_download_running_title", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Driver installer successfully downloaded.. /// Looks up a localized string similar to Driver installer successfully downloaded..
/// </summary> /// </summary>

View file

@ -135,6 +135,9 @@
<data name="info_download_running" xml:space="preserve"> <data name="info_download_running" xml:space="preserve">
<value>Ein Downloadvorgang läuft bereits!</value> <value>Ein Downloadvorgang läuft bereits!</value>
</data> </data>
<data name="info_download_running_title" xml:space="preserve">
<value>Download läuft</value>
</data>
<data name="info_download_success" xml:space="preserve"> <data name="info_download_success" xml:space="preserve">
<value>Treiber-Installationsdatei erfolgreich heruntergeladen.</value> <value>Treiber-Installationsdatei erfolgreich heruntergeladen.</value>
</data> </data>

View file

@ -135,6 +135,9 @@
<data name="info_download_running" xml:space="preserve"> <data name="info_download_running" xml:space="preserve">
<value>A download process is already running!</value> <value>A download process is already running!</value>
</data> </data>
<data name="info_download_running_title" xml:space="preserve">
<value>Download running</value>
</data>
<data name="info_download_success" xml:space="preserve"> <data name="info_download_success" xml:space="preserve">
<value>Driver installer successfully downloaded.</value> <value>Driver installer successfully downloaded.</value>
</data> </data>

View file

@ -33,6 +33,13 @@ namespace EnvyUpdate
if (GlobalVars.autoDownload) if (GlobalVars.autoDownload)
chkAutodl.IsChecked = true; chkAutodl.IsChecked = true;
if (GlobalVars.isDownloading)
{
chkAppdata.IsEnabled = false;
}
else
chkAppdata.IsEnabled = true;
textBoxLicEnvyupdate.Text = Properties.Licenses.EnvyUpdate; textBoxLicEnvyupdate.Text = Properties.Licenses.EnvyUpdate;
textBoxLicFody.Text = Properties.Licenses.Fody; textBoxLicFody.Text = Properties.Licenses.Fody;
textBoxLicCostura.Text = Properties.Licenses.CosturaFody; textBoxLicCostura.Text = Properties.Licenses.CosturaFody;