mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-27 11:03:04 +00:00
Update file type and lang selection to use ToggleType
This commit is contained in:
parent
1d7c624a2b
commit
febb0fc308
1 changed files with 8 additions and 5 deletions
|
@ -35,22 +35,23 @@ namespace Ryujinx.Ava.UI.Views.Main
|
||||||
ChangeLanguageMenuItem.ItemsSource = GenerateLanguageMenuItems();
|
ChangeLanguageMenuItem.ItemsSource = GenerateLanguageMenuItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
private CheckBox[] GenerateToggleFileTypeItems()
|
private MenuItem[] GenerateToggleFileTypeItems()
|
||||||
{
|
{
|
||||||
List<CheckBox> checkBoxes = new();
|
List<MenuItem> items = new();
|
||||||
|
|
||||||
foreach (var item in Enum.GetValues(typeof(FileTypes)))
|
foreach (var item in Enum.GetValues(typeof(FileTypes)))
|
||||||
{
|
{
|
||||||
string fileName = Enum.GetName(typeof(FileTypes), item);
|
string fileName = Enum.GetName(typeof(FileTypes), item);
|
||||||
checkBoxes.Add(new CheckBox
|
items.Add(new MenuItem
|
||||||
{
|
{
|
||||||
Content = $".{fileName}",
|
Header = $".{fileName}",
|
||||||
|
ToggleType = MenuItemToggleType.CheckBox,
|
||||||
IsChecked = ((FileTypes)item).GetConfigValue(ConfigurationState.Instance.UI.ShownFileTypes),
|
IsChecked = ((FileTypes)item).GetConfigValue(ConfigurationState.Instance.UI.ShownFileTypes),
|
||||||
Command = MiniCommand.Create(() => Window.ToggleFileType(fileName)),
|
Command = MiniCommand.Create(() => Window.ToggleFileType(fileName)),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return checkBoxes.ToArray();
|
return items.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MenuItem[] GenerateLanguageMenuItems()
|
private static MenuItem[] GenerateLanguageMenuItems()
|
||||||
|
@ -78,6 +79,8 @@ namespace Ryujinx.Ava.UI.Views.Main
|
||||||
MenuItem menuItem = new()
|
MenuItem menuItem = new()
|
||||||
{
|
{
|
||||||
Header = languageName,
|
Header = languageName,
|
||||||
|
ToggleType = MenuItemToggleType.Radio,
|
||||||
|
IsChecked = languageCode == ConfigurationState.Instance.UI.LanguageCode,
|
||||||
Command = MiniCommand.Create(() =>
|
Command = MiniCommand.Create(() =>
|
||||||
{
|
{
|
||||||
MainWindowViewModel.ChangeLanguage(languageCode);
|
MainWindowViewModel.ChangeLanguage(languageCode);
|
||||||
|
|
Loading…
Reference in a new issue