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})",
"UpdateWindowTitle": "Title Update Manager",
"CheatWindowHeading": "Cheats Available for {0} [{1}]",
"DlcWindowHeading": "{0} Downloadable Content(s) available for {1} ({2})",
"DlcWindowHeading": "{0} Downloadable Content(s)",
"UserProfilesEditProfile": "Edit Selected",
"Cancel": "Cancel",
"Save": "Save",

View file

@ -45,6 +45,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{
_downloadableContents = value;
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)
{
_virtualFileSystem = virtualFileSystem;
@ -225,18 +231,12 @@ namespace Ryujinx.Ava.UI.ViewModels
public void EnableAll()
{
foreach(var item in DownloadableContents)
{
item.Enabled = true;
}
SelectedDownloadableContents = new(DownloadableContents);
}
public void DisableAll()
{
foreach (var item in DownloadableContents)
{
item.Enabled = false;
}
SelectedDownloadableContents.Clear();
}
public void Save()

View file

@ -9,18 +9,46 @@
xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
Width="500"
Height="300"
Height="380"
mc:Ignorable="d"
x:CompileBindings="True"
x:DataType="viewModels:DownloadableContentManagerViewModel"
Focusable="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</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
Grid.Row="0"
Grid.Row="1"
Margin="0 0 0 24"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@ -29,6 +57,7 @@
CornerRadius="5"
Padding="2.5">
<ListBox
AutoScrollToSelectedItem="False"
VirtualizationMode="None"
SelectionMode="Multiple"
Background="Transparent"
@ -107,7 +136,7 @@
</ListBox>
</Border>
<Panel
Grid.Row="1"
Grid.Row="2"
HorizontalAlignment="Stretch">
<StackPanel
Orientation="Horizontal"