add auto download feature

This commit is contained in:
Jakob 2024-02-23 20:30:40 +01:00
parent 3f925ee17a
commit b9e7aac55f
7 changed files with 45 additions and 3 deletions

View file

@ -210,6 +210,12 @@ namespace EnvyUpdate
if (skippedVer != onlineDriv) if (skippedVer != onlineDriv)
{ {
if (GlobalVars.autoDownload)
{
Debug.LogToFile("INFO Auto-Downloading driver.");
buttonDownload_Click(null, null);
}
Debug.LogToFile("INFO Showing update popup notification."); Debug.LogToFile("INFO Showing update popup notification.");
Notify.ShowDrivUpdatePopup(); Notify.ShowDrivUpdatePopup();
} }

View file

@ -19,5 +19,6 @@ namespace EnvyUpdate
public static readonly string useragent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:115.0) Gecko/20100101 Firefox/115.0"; public static readonly string useragent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:115.0) Gecko/20100101 Firefox/115.0";
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;
} }
} }

View file

@ -267,6 +267,15 @@ namespace EnvyUpdate.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Download updates automatically.
/// </summary>
public static string ui_enable_autodownload {
get {
return ResourceManager.GetString("ui_enable_autodownload", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Enable logging to file. /// Looks up a localized string similar to Enable logging to file.
/// </summary> /// </summary>

View file

@ -186,6 +186,9 @@
<data name="ui_enable_appdata" xml:space="preserve"> <data name="ui_enable_appdata" xml:space="preserve">
<value>Programmdaten in AppData speichern</value> <value>Programmdaten in AppData speichern</value>
</data> </data>
<data name="ui_enable_autodownload" xml:space="preserve">
<value>Updates automatisch herunterladen</value>
</data>
<data name="ui_enable_logging" xml:space="preserve"> <data name="ui_enable_logging" xml:space="preserve">
<value>Programm-Log in Datei schreiben</value> <value>Programm-Log in Datei schreiben</value>
</data> </data>

View file

@ -186,6 +186,9 @@
<data name="ui_enable_appdata" xml:space="preserve"> <data name="ui_enable_appdata" xml:space="preserve">
<value>Save files to AppData</value> <value>Save files to AppData</value>
</data> </data>
<data name="ui_enable_autodownload" xml:space="preserve">
<value>Download updates automatically</value>
</data>
<data name="ui_enable_logging" xml:space="preserve"> <data name="ui_enable_logging" xml:space="preserve">
<value>Enable logging to file</value> <value>Enable logging to file</value>
</data> </data>

View file

@ -35,9 +35,19 @@
<ui:ToggleSwitch x:Name="chkLog" Checked="chkLog_Checked" Unchecked="chkLog_Unchecked"/> <ui:ToggleSwitch x:Name="chkLog" Checked="chkLog_Checked" Unchecked="chkLog_Unchecked"/>
</ui:CardControl> </ui:CardControl>
<ui:CardControl Grid.Row="3" Margin="0,12,0,0" Icon="Folder24" Header="{x:Static p:Resources.ui_enable_appdata}" > <Grid Grid.Row="3">
<ui:ToggleSwitch x:Name="chkAppdata" Checked="chkAppdata_Checked" Unchecked="chkAppdata_Unchecked"/> <Grid.ColumnDefinitions>
</ui:CardControl> <ColumnDefinition Width="1*"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<ui:CardControl Grid.Column="0" Margin="0,12,0,0" Icon="Folder24" Header="{x:Static p:Resources.ui_enable_appdata}" VerticalAlignment="Top" >
<ui:ToggleSwitch x:Name="chkAppdata" Checked="chkAppdata_Checked" Unchecked="chkAppdata_Unchecked"/>
</ui:CardControl>
<ui:CardControl Grid.Column="2" Margin="0,12,0,0" Icon="ArrowDownload24" Header="{x:Static p:Resources.ui_enable_autodownload}" VerticalAlignment="Top">
<ui:ToggleSwitch x:Name="chkAutodl" Checked="chkAutodl_Checked" Unchecked="chkAutodl_Unchecked"/>
</ui:CardControl>
</Grid>
<Label Grid.Row="4" Content="{x:Static p:Resources.ui_licenses}" HorizontalAlignment="Left" VerticalAlignment="Top" FontWeight="Bold"/> <Label Grid.Row="4" Content="{x:Static p:Resources.ui_licenses}" HorizontalAlignment="Left" VerticalAlignment="Top" FontWeight="Bold"/>
<ScrollViewer Grid.Row="5" MaxHeight="700" HorizontalAlignment="Stretch"> <ScrollViewer Grid.Row="5" MaxHeight="700" HorizontalAlignment="Stretch">

View file

@ -91,5 +91,15 @@ namespace EnvyUpdate
Debug.LogToFile("INFO Switched to EXE directory."); Debug.LogToFile("INFO Switched to EXE directory.");
} }
private void chkAutodl_Checked(object sender, RoutedEventArgs e)
{
GlobalVars.autoDownload = true;
}
private void chkAutodl_Unchecked(object sender, RoutedEventArgs e)
{
GlobalVars.autoDownload = false;
}
} }
} }