diff --git a/src/LegendaryGameInstaller.xaml b/src/LegendaryGameInstaller.xaml index 000c2e6..1c1c697 100644 --- a/src/LegendaryGameInstaller.xaml +++ b/src/LegendaryGameInstaller.xaml @@ -69,19 +69,24 @@ - - - - - + + + + + + + + + + diff --git a/src/LegendaryGameInstaller.xaml.cs b/src/LegendaryGameInstaller.xaml.cs index bd4d8c1..a67b850 100644 --- a/src/LegendaryGameInstaller.xaml.cs +++ b/src/LegendaryGameInstaller.xaml.cs @@ -31,6 +31,7 @@ public partial class LegendaryGameInstaller : UserControl public double downloadSizeNumber; public double installSizeNumber; private LegendaryGameInfo.Rootobject manifest; + public bool uncheckedByUser = true; public LegendaryGameInstaller() { @@ -99,7 +100,7 @@ private async void InstallBtn_Click(object sender, RoutedEventArgs e) selectedExtraContent.AddMissing(""); foreach (var selectedOption in ExtraContentLB.SelectedItems.Cast>().ToList()) { - if (selectedOption.Value.Is_dlc == false) + if (!selectedOption.Value.Is_dlc) { foreach (var tag in selectedOption.Value.Tags) { @@ -407,6 +408,7 @@ private async void LegendaryGameInstallerUC_Loaded(object sender, RoutedEventArg } } } + AllDlcsChk.Visibility = Visibility.Visible; } if (extraContentInfo.Keys.Count > 0) { @@ -625,5 +627,54 @@ private async void RepairBtn_Click(object sender, RoutedEventArgs e) await downloadManager.EnqueueJob(GameID, InstallerWindow.Title, downloadSize, installSize, downloadProperties); } } + + private void AllDlcsChk_Checked(object sender, RoutedEventArgs e) + { + var dlcs = ExtraContentLB.Items.Cast>().Where(x => x.Value.Is_dlc).ToList(); + foreach (var dlc in dlcs) + { + ExtraContentLB.SelectedItems.Add(dlc); + } + } + + private void AllDlcsChk_Unchecked(object sender, RoutedEventArgs e) + { + if (uncheckedByUser) + { + var dlcs = ExtraContentLB.SelectedItems.Cast>().Where(x => x.Value.Is_dlc).ToList(); + foreach (var dlc in dlcs) + { + ExtraContentLB.SelectedItems.Remove(dlc); + } + } + } + + private void ExtraContentLBChk_Unchecked(object sender, RoutedEventArgs e) + { + uncheckedByUser = false; + if (AllOrNothingChk.IsChecked == true) + { + AllOrNothingChk.IsChecked = false; + } + var extraCheckbox = sender as CheckBox; + if (AllDlcsChk.IsChecked == true && (bool)extraCheckbox.Tag) + { + AllDlcsChk.IsChecked = false; + } + uncheckedByUser = true; + } + + private void AllOrNothingChk_Checked(object sender, RoutedEventArgs e) + { + ExtraContentLB.SelectAll(); + } + + private void AllOrNothingChk_Unchecked(object sender, RoutedEventArgs e) + { + if (uncheckedByUser) + { + ExtraContentLB.SelectedItems.Clear(); + } + } } } diff --git a/src/Localization/en_US.xaml b/src/Localization/en_US.xaml index bf5c635..cf828be 100644 --- a/src/Localization/en_US.xaml +++ b/src/Localization/en_US.xaml @@ -94,4 +94,6 @@ Alternative executable file Cloud saves Display download speed in bits per second + Check all DLCs + Check all \ No newline at end of file diff --git a/src/LocalizationKeys.cs b/src/LocalizationKeys.cs index e37d896..8570438 100644 --- a/src/LocalizationKeys.cs +++ b/src/LocalizationKeys.cs @@ -577,5 +577,13 @@ public static class LOC /// Display download speed in bits per second /// public const string LegendaryDisplayDownloadSpeedInBits = "LOCLegendaryDisplayDownloadSpeedInBits"; + /// + /// Check all DLCs + /// + public const string LegendaryCheckAllDlcs = "LOCLegendaryCheckAllDlcs"; + /// + /// Check all + /// + public const string LegendaryCheckAllContent = "LOCLegendaryCheckAllContent"; } }