Formatting and error

More Ava 11-ness

Whoops
This commit is contained in:
Isaac Marovitz 2023-08-12 11:52:46 +01:00 committed by Isaac Marovitz
parent 5e8eedae37
commit 02b355eebf
12 changed files with 260 additions and 258 deletions

View file

@ -1,7 +1,7 @@
using Avalonia;
using Avalonia.Data;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Data;
using Avalonia.LogicalTree;
using Avalonia.Threading;
using Ryujinx.Ava.Common.Locale;

View file

@ -25,8 +25,7 @@ namespace Ryujinx.Ava.UI.Views.Input
{
if (visual is ToggleButton button && !(visual is CheckBox))
{
button.Checked += Button_Checked;
button.Unchecked += Button_Unchecked;
button.IsCheckedChanged += Button_IsCheckedChanged;
}
}
}
@ -41,9 +40,11 @@ namespace Ryujinx.Ava.UI.Views.Input
}
}
private void Button_Checked(object sender, RoutedEventArgs e)
private void Button_IsCheckedChanged(object sender, RoutedEventArgs e)
{
if (sender is ToggleButton button)
{
if ((bool)button.IsChecked)
{
if (_currentAssigner != null && button == _currentAssigner.ToggledButton)
{
@ -56,7 +57,7 @@ namespace Ryujinx.Ava.UI.Views.Input
{
_currentAssigner = new ButtonKeyAssigner(button);
FocusManager.Instance.Focus(this, NavigationMethod.Pointer);
this.Focus(NavigationMethod.Pointer);
PointerPressed += MouseClick;
@ -156,13 +157,13 @@ namespace Ryujinx.Ava.UI.Views.Input
}
}
}
}
private void Button_Unchecked(object sender, RoutedEventArgs e)
else
{
_currentAssigner?.Cancel();
_currentAssigner = null;
}
}
}
private void MouseClick(object sender, PointerPressedEventArgs e)
{

View file

@ -63,7 +63,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
SelectionChanged="PlayerIndexBox_OnSelectionChanged"
Items="{Binding PlayerIndexes}"
ItemsSource="{Binding PlayerIndexes}"
SelectedIndex="{Binding PlayerId}">
<ComboBox.ItemTemplate>
<DataTemplate>
@ -91,14 +91,14 @@
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsProfile}" />
<ui:ComboBox
<ui:FAComboBox
Grid.Column="1"
IsEditable="True"
Name="ProfileBox"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
SelectedIndex="0"
Items="{Binding ProfilesList}"
ItemsSource="{Binding ProfilesList}"
Text="{Binding ProfileName}" />
<Button
Grid.Column="2"
@ -167,7 +167,7 @@
Name="DeviceBox"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Items="{Binding DeviceList}"
ItemsSource="{Binding DeviceList}"
SelectedIndex="{Binding Device}" />
<Button
Grid.Column="2"
@ -200,7 +200,7 @@
<ComboBox
Grid.Column="1"
HorizontalAlignment="Stretch"
Items="{ReflectionBinding Controllers}"
ItemsSource="{ReflectionBinding Controllers}"
SelectedIndex="{ReflectionBinding Controller}">
<ComboBox.ItemTemplate>
<DataTemplate DataType="models:ControllerModel">

View file

@ -24,8 +24,7 @@ namespace Ryujinx.Ava.UI.Views.Input
{
if (visual is ToggleButton button && !(visual is CheckBox))
{
button.Checked += Button_Checked;
button.Unchecked += Button_Unchecked;
button.IsCheckedChanged += Button_IsCheckedChanged;
}
}
}
@ -40,9 +39,11 @@ namespace Ryujinx.Ava.UI.Views.Input
}
}
private void Button_Checked(object sender, RoutedEventArgs e)
private void Button_IsCheckedChanged(object sender, RoutedEventArgs e)
{
if (sender is ToggleButton button)
{
if ((bool)button.IsChecked)
{
if (_currentAssigner != null && button == _currentAssigner.ToggledButton)
{
@ -55,7 +56,7 @@ namespace Ryujinx.Ava.UI.Views.Input
{
_currentAssigner = new ButtonKeyAssigner(button);
FocusManager.Instance.Focus(this, NavigationMethod.Pointer);
this.Focus(NavigationMethod.Pointer);
PointerPressed += MouseClick;
@ -173,13 +174,13 @@ namespace Ryujinx.Ava.UI.Views.Input
}
}
}
}
private void Button_Unchecked(object sender, RoutedEventArgs e)
else
{
_currentAssigner?.Cancel();
_currentAssigner = null;
}
}
}
private void MouseClick(object sender, PointerPressedEventArgs e)
{