misc: Replace references to IntPtr/UIntPtr with nint/nuint + code cleanups.

This commit is contained in:
Evan Husted 2024-10-26 08:46:41 -05:00
parent a09d314817
commit dfb4854d19
172 changed files with 902 additions and 914 deletions

View file

@ -36,23 +36,17 @@ namespace Ryujinx.Ava.UI.Views.Main
ChangeLanguageMenuItem.ItemsSource = GenerateLanguageMenuItems();
}
private CheckBox[] GenerateToggleFileTypeItems()
{
List<CheckBox> checkBoxes = new();
foreach (var item in Enum.GetValues(typeof(FileTypes)))
{
string fileName = Enum.GetName(typeof(FileTypes), item);
checkBoxes.Add(new CheckBox
{
Content = $".{fileName}",
IsChecked = ((FileTypes)item).GetConfigValue(ConfigurationState.Instance.UI.ShownFileTypes),
Command = MiniCommand.Create(() => Window.ToggleFileType(fileName)),
});
}
return checkBoxes.ToArray();
}
private CheckBox[] GenerateToggleFileTypeItems() =>
Enum.GetValues<FileTypes>()
.Select(it => (FileName: Enum.GetName(it)!, FileType: it))
.Select(it =>
new CheckBox
{
Content = $".{it.FileName}",
IsChecked = it.FileType.GetConfigValue(ConfigurationState.Instance.UI.ShownFileTypes),
Command = MiniCommand.Create(() => Window.ToggleFileType(it.FileName))
}
).ToArray();
private static MenuItem[] GenerateLanguageMenuItems()
{
@ -80,7 +74,7 @@ namespace Ryujinx.Ava.UI.Views.Main
{
Padding = new Thickness(10, 0, 0, 0),
Header = " " + languageName,
Command = MiniCommand.Create(() => MainWindowViewModel.ChangeLanguage(languageCode)),
Command = MiniCommand.Create(() => MainWindowViewModel.ChangeLanguage(languageCode))
};
menuItems.Add(menuItem);

View file

@ -5,6 +5,7 @@ using Avalonia.Interactivity;
using Avalonia.Threading;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.Windows;
using Ryujinx.Common;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.UI.Common.Configuration;
@ -46,7 +47,7 @@ namespace Ryujinx.Ava.UI.Views.Main
private void DockedStatus_PointerReleased(object sender, PointerReleasedEventArgs e)
{
ConfigurationState.Instance.System.EnableDockedMode.Value = !ConfigurationState.Instance.System.EnableDockedMode.Value;
ConfigurationState.Instance.System.EnableDockedMode.Toggle();
}
private void AspectRatioStatus_OnClick(object sender, RoutedEventArgs e)