Enable all/disable all buttons

This commit is contained in:
Isaac Marovitz 2023-01-15 17:29:58 -05:00
parent 96cf9b0ef6
commit c0ab32bc38
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1
3 changed files with 41 additions and 12 deletions

View file

@ -586,7 +586,7 @@
"DlcWindowTitle": "Manage Downloadable Content for {0} ({1})", "DlcWindowTitle": "Manage Downloadable Content for {0} ({1})",
"UpdateWindowTitle": "Title Update Manager", "UpdateWindowTitle": "Title Update Manager",
"CheatWindowHeading": "Cheats Available for {0} [{1}]", "CheatWindowHeading": "Cheats Available for {0} [{1}]",
"DlcWindowHeading": "{0} Downloadable Content(s) available for {1} ({2})", "DlcWindowHeading": "{0} Downloadable Content(s)",
"UserProfilesEditProfile": "Edit Selected", "UserProfilesEditProfile": "Edit Selected",
"Cancel": "Cancel", "Cancel": "Cancel",
"Save": "Save", "Save": "Save",

View file

@ -45,6 +45,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{ {
_downloadableContents = value; _downloadableContents = value;
OnPropertyChanged(); OnPropertyChanged();
OnPropertyChanged(nameof(UpdateCount));
} }
} }
@ -58,6 +59,11 @@ namespace Ryujinx.Ava.UI.ViewModels
} }
} }
public string UpdateCount
{
get => string.Format(LocaleManager.Instance[LocaleKeys.DlcWindowHeading], DownloadableContents.Count);
}
public DownloadableContentManagerViewModel(VirtualFileSystem virtualFileSystem, ulong titleId, string titleName) public DownloadableContentManagerViewModel(VirtualFileSystem virtualFileSystem, ulong titleId, string titleName)
{ {
_virtualFileSystem = virtualFileSystem; _virtualFileSystem = virtualFileSystem;
@ -225,18 +231,12 @@ namespace Ryujinx.Ava.UI.ViewModels
public void EnableAll() public void EnableAll()
{ {
foreach(var item in DownloadableContents) SelectedDownloadableContents = new(DownloadableContents);
{
item.Enabled = true;
}
} }
public void DisableAll() public void DisableAll()
{ {
foreach (var item in DownloadableContents) SelectedDownloadableContents.Clear();
{
item.Enabled = false;
}
} }
public void Save() public void Save()

View file

@ -9,18 +9,46 @@
xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models" xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
Width="500" Width="500"
Height="300" Height="380"
mc:Ignorable="d" mc:Ignorable="d"
x:CompileBindings="True" x:CompileBindings="True"
x:DataType="viewModels:DownloadableContentManagerViewModel" x:DataType="viewModels:DownloadableContentManagerViewModel"
Focusable="True"> Focusable="True">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Panel
Margin="0 0 0 10"
Grid.Row="0">
<StackPanel
Orientation="Horizontal"
HorizontalAlignment="Left">
<TextBlock Text="{Binding UpdateCount}" />
</StackPanel>
<StackPanel
Orientation="Horizontal"
HorizontalAlignment="Right">
<Button
Name="EnableAllButton"
MinWidth="90"
Margin="5"
Command="{ReflectionBinding EnableAll}">
<TextBlock Text="{locale:Locale DlcManagerEnableAllButton}" />
</Button>
<Button
Name="DisableAllButton"
MinWidth="90"
Margin="5"
Command="{ReflectionBinding DisableAll}">
<TextBlock Text="{locale:Locale DlcManagerDisableAllButton}" />
</Button>
</StackPanel>
</Panel>
<Border <Border
Grid.Row="0" Grid.Row="1"
Margin="0 0 0 24" Margin="0 0 0 24"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
@ -29,6 +57,7 @@
CornerRadius="5" CornerRadius="5"
Padding="2.5"> Padding="2.5">
<ListBox <ListBox
AutoScrollToSelectedItem="False"
VirtualizationMode="None" VirtualizationMode="None"
SelectionMode="Multiple" SelectionMode="Multiple"
Background="Transparent" Background="Transparent"
@ -107,7 +136,7 @@
</ListBox> </ListBox>
</Border> </Border>
<Panel <Panel
Grid.Row="1" Grid.Row="2"
HorizontalAlignment="Stretch"> HorizontalAlignment="Stretch">
<StackPanel <StackPanel
Orientation="Horizontal" Orientation="Horizontal"