aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Ava/UI/Helpers
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-07-07 23:03:27 +0200
committerGitHub <noreply@github.com>2023-07-07 23:03:27 +0200
commit6c515e18228b93c4d856129ba55a692e830cbdaa (patch)
tree661a3be3cf71c5276e82cb4fcc13b39f9e7f9f90 /src/Ryujinx.Ava/UI/Helpers
parent8a363b5df2387bd254a3dd48bfd3c9884ff74dab (diff)
[Ryujinx.Ava] Address dotnet-format issues (#5361)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Silence dotnet format IDE0059 warnings * Address or silence dotnet format IDE1006 warnings * Address dotnet format CA1816 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Make dotnet format succeed in style mode * Address dotnet format CA1401 warnings * Address remaining dotnet format analyzer warnings * Address review comments * dotnet-format fixes after rebase * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Format if-blocks correctly * Another rebase, another dotnet format run * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Add comments to disabled warnings * Remove a few unused parameters * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Address IDE0260 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * dotnet format pass with new editorconfig * Fix naming style issues * Apply suggestions from code review Co-authored-by: Ac_K <Acoustik666@gmail.com> * Revert one suggestion * Second dotnet format pass and fix build issues * Final pass of dotnet format * Add trailing commas * Fix formatting issues * Keep unnecessary assignment in IconColorPicker.cs * Use using declarations and extend resource lifetimes * Fix rebase issues * Adjust comment spacing * Fix typo * Fix naming issues * Apply suggestions from code review Co-authored-by: Ac_K <Acoustik666@gmail.com> * Revert unintentional change * Remove unused file * Remove static keyword from ViewModels Binding of static members doesn't work and is silently ignored. --------- Co-authored-by: Ac_K <Acoustik666@gmail.com>
Diffstat (limited to 'src/Ryujinx.Ava/UI/Helpers')
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/ApplicationOpenedEventArgs.cs2
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/BitmapArrayValueConverter.cs2
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs2
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/ContentDialogHelper.cs61
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/GlyphValueConverter.cs17
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/HotKeyControl.cs2
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/KeyValueConverter.cs2
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/LoggerAdapter.cs28
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/MiniCommand.cs4
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/NotificationHelper.cs8
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/NullableDateTimeConverter.cs2
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/OffscreenTextBox.cs10
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/UserErrorDialog.cs13
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/UserResult.cs2
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs54
15 files changed, 105 insertions, 104 deletions
diff --git a/src/Ryujinx.Ava/UI/Helpers/ApplicationOpenedEventArgs.cs b/src/Ryujinx.Ava/UI/Helpers/ApplicationOpenedEventArgs.cs
index ebf5c16e..cd63a99b 100644
--- a/src/Ryujinx.Ava/UI/Helpers/ApplicationOpenedEventArgs.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/ApplicationOpenedEventArgs.cs
@@ -13,4 +13,4 @@ namespace Ryujinx.Ava.UI.Helpers
RoutedEvent = routedEvent;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/BitmapArrayValueConverter.cs b/src/Ryujinx.Ava/UI/Helpers/BitmapArrayValueConverter.cs
index 133f8dbc..42bd8d5a 100644
--- a/src/Ryujinx.Ava/UI/Helpers/BitmapArrayValueConverter.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/BitmapArrayValueConverter.cs
@@ -33,4 +33,4 @@ namespace Ryujinx.Ava.UI.Helpers
throw new NotSupportedException();
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs b/src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs
index 6730b571..7e8ba734 100644
--- a/src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs
@@ -23,7 +23,7 @@ namespace Ryujinx.Ava.UI.Helpers
IsAssigned = isAssigned;
}
}
-
+
public ToggleButton ToggledButton { get; set; }
private bool _isWaitingForInput;
diff --git a/src/Ryujinx.Ava/UI/Helpers/ContentDialogHelper.cs b/src/Ryujinx.Ava/UI/Helpers/ContentDialogHelper.cs
index 045d508c..7dab57b8 100644
--- a/src/Ryujinx.Ava/UI/Helpers/ContentDialogHelper.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/ContentDialogHelper.cs
@@ -1,6 +1,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.Threading;
using FluentAvalonia.Core;
@@ -32,18 +33,17 @@ namespace Ryujinx.Ava.UI.Helpers
ContentDialog contentDialog = new()
{
- Title = title,
- PrimaryButtonText = primaryButton,
+ Title = title,
+ PrimaryButtonText = primaryButton,
SecondaryButtonText = secondaryButton,
- CloseButtonText = closeButton,
- Content = content
+ CloseButtonText = closeButton,
+ Content = content,
+ PrimaryButtonCommand = MiniCommand.Create(() =>
+ {
+ result = primaryButtonResult;
+ }),
};
- contentDialog.PrimaryButtonCommand = MiniCommand.Create(() =>
- {
- result = primaryButtonResult;
- });
-
contentDialog.SecondaryButtonCommand = MiniCommand.Create(() =>
{
result = UserResult.No;
@@ -96,7 +96,6 @@ namespace Ryujinx.Ava.UI.Helpers
Func<Window, Task> doWhileDeferred = null)
{
bool startedDeferring = false;
- UserResult result = UserResult.None;
return await ShowTextDialog(
title,
@@ -123,8 +122,6 @@ namespace Ryujinx.Ava.UI.Helpers
var deferral = args.GetDeferral();
- result = primaryButton == LocaleManager.Instance[LocaleKeys.InputDialogYes] ? UserResult.Yes : UserResult.Ok;
-
sender.PrimaryButtonClick -= DeferClose;
_ = Task.Run(() =>
@@ -150,18 +147,18 @@ namespace Ryujinx.Ava.UI.Helpers
{
Grid content = new()
{
- RowDefinitions = new RowDefinitions() { new RowDefinition(), new RowDefinition() },
- ColumnDefinitions = new ColumnDefinitions() { new ColumnDefinition(GridLength.Auto), new ColumnDefinition() },
+ RowDefinitions = new RowDefinitions { new(), new() },
+ ColumnDefinitions = new ColumnDefinitions { new(GridLength.Auto), new() },
- MinHeight = 80
+ MinHeight = 80,
};
SymbolIcon icon = new()
{
- Symbol = (Symbol)symbol,
- Margin = new Thickness(10),
- FontSize = 40,
- VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center
+ Symbol = (Symbol)symbol,
+ Margin = new Thickness(10),
+ FontSize = 40,
+ VerticalAlignment = VerticalAlignment.Center,
};
Grid.SetColumn(icon, 0);
@@ -170,18 +167,18 @@ namespace Ryujinx.Ava.UI.Helpers
TextBlock primaryLabel = new()
{
- Text = primaryText,
- Margin = new Thickness(5),
+ Text = primaryText,
+ Margin = new Thickness(5),
TextWrapping = TextWrapping.Wrap,
- MaxWidth = 450
+ MaxWidth = 450,
};
TextBlock secondaryLabel = new()
{
- Text = secondaryText,
- Margin = new Thickness(5),
+ Text = secondaryText,
+ Margin = new Thickness(5),
TextWrapping = TextWrapping.Wrap,
- MaxWidth = 450
+ MaxWidth = 450,
};
Grid.SetColumn(primaryLabel, 1);
@@ -318,14 +315,14 @@ namespace Ryujinx.Ava.UI.Helpers
Window parent = GetMainWindow();
- if (parent != null && parent.IsActive && (parent as MainWindow).ViewModel.IsGameRunning)
+ if (parent is { IsActive: true } and MainWindow window && window.ViewModel.IsGameRunning)
{
contentDialogOverlayWindow = new()
{
- Height = parent.Bounds.Height,
- Width = parent.Bounds.Width,
- Position = parent.PointToScreen(new Point()),
- ShowInTaskbar = false
+ Height = parent.Bounds.Height,
+ Width = parent.Bounds.Width,
+ Position = parent.PointToScreen(new Point()),
+ ShowInTaskbar = false,
};
parent.PositionChanged += OverlayOnPositionChanged;
@@ -389,7 +386,7 @@ namespace Ryujinx.Ava.UI.Helpers
private static Window GetMainWindow()
{
- if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime al)
+ if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime al)
{
foreach (Window item in al.Windows)
{
@@ -403,4 +400,4 @@ namespace Ryujinx.Ava.UI.Helpers
return null;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/GlyphValueConverter.cs b/src/Ryujinx.Ava/UI/Helpers/GlyphValueConverter.cs
index 3d6c9c01..4e4b971e 100644
--- a/src/Ryujinx.Ava/UI/Helpers/GlyphValueConverter.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/GlyphValueConverter.cs
@@ -1,5 +1,6 @@
using Avalonia.Data;
using Avalonia.Markup.Xaml;
+using Avalonia.Markup.Xaml.MarkupExtensions;
using FluentAvalonia.UI.Controls;
using System;
using System.Collections.Generic;
@@ -8,13 +9,13 @@ namespace Ryujinx.Ava.UI.Helpers
{
public class GlyphValueConverter : MarkupExtension
{
- private string _key;
+ private readonly string _key;
- private static Dictionary<Glyph, string> _glyphs = new Dictionary<Glyph, string>
+ private static readonly Dictionary<Glyph, string> _glyphs = new()
{
- { Glyph.List, char.ConvertFromUtf32((int)Symbol.List).ToString() },
- { Glyph.Grid, char.ConvertFromUtf32((int)Symbol.ViewAll).ToString() },
- { Glyph.Chip, char.ConvertFromUtf32(59748).ToString() }
+ { Glyph.List, char.ConvertFromUtf32((int)Symbol.List) },
+ { Glyph.Grid, char.ConvertFromUtf32((int)Symbol.ViewAll) },
+ { Glyph.Chip, char.ConvertFromUtf32(59748) },
};
public GlyphValueConverter(string key)
@@ -37,13 +38,13 @@ namespace Ryujinx.Ava.UI.Helpers
public override object ProvideValue(IServiceProvider serviceProvider)
{
- Avalonia.Markup.Xaml.MarkupExtensions.ReflectionBindingExtension binding = new($"[{_key}]")
+ ReflectionBindingExtension binding = new($"[{_key}]")
{
Mode = BindingMode.OneWay,
- Source = this
+ Source = this,
};
return binding.ProvideValue(serviceProvider);
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/HotKeyControl.cs b/src/Ryujinx.Ava/UI/Helpers/HotKeyControl.cs
index f1fad157..4ae903b4 100644
--- a/src/Ryujinx.Ava/UI/Helpers/HotKeyControl.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/HotKeyControl.cs
@@ -49,4 +49,4 @@ namespace Ryujinx.Ava.UI.Helpers
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/KeyValueConverter.cs b/src/Ryujinx.Ava/UI/Helpers/KeyValueConverter.cs
index 8d5c2815..028ed6bf 100644
--- a/src/Ryujinx.Ava/UI/Helpers/KeyValueConverter.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/KeyValueConverter.cs
@@ -43,4 +43,4 @@ namespace Ryujinx.Ava.UI.Helpers
return key;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/LoggerAdapter.cs b/src/Ryujinx.Ava/UI/Helpers/LoggerAdapter.cs
index 7a29cc19..dc8e3f94 100644
--- a/src/Ryujinx.Ava/UI/Helpers/LoggerAdapter.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/LoggerAdapter.cs
@@ -1,15 +1,17 @@
+using Avalonia.Logging;
using Avalonia.Utilities;
+using Ryujinx.Common.Logging;
using System;
using System.Text;
namespace Ryujinx.Ava.UI.Helpers
{
- using AvaLogger = Avalonia.Logging.Logger;
- using AvaLogLevel = Avalonia.Logging.LogEventLevel;
- using RyuLogClass = Ryujinx.Common.Logging.LogClass;
- using RyuLogger = Ryujinx.Common.Logging.Logger;
+ using AvaLogger = Avalonia.Logging.Logger;
+ using AvaLogLevel = LogEventLevel;
+ using RyuLogClass = LogClass;
+ using RyuLogger = Ryujinx.Common.Logging.Logger;
- internal class LoggerAdapter : Avalonia.Logging.ILogSink
+ internal class LoggerAdapter : ILogSink
{
public static void Register()
{
@@ -20,13 +22,13 @@ namespace Ryujinx.Ava.UI.Helpers
{
return level switch
{
- AvaLogLevel.Verbose => RyuLogger.Debug,
- AvaLogLevel.Debug => RyuLogger.Debug,
+ AvaLogLevel.Verbose => RyuLogger.Debug,
+ AvaLogLevel.Debug => RyuLogger.Debug,
AvaLogLevel.Information => RyuLogger.Debug,
- AvaLogLevel.Warning => RyuLogger.Debug,
- AvaLogLevel.Error => RyuLogger.Error,
- AvaLogLevel.Fatal => RyuLogger.Error,
- _ => throw new ArgumentOutOfRangeException(nameof(level), level, null)
+ AvaLogLevel.Warning => RyuLogger.Debug,
+ AvaLogLevel.Error => RyuLogger.Error,
+ AvaLogLevel.Fatal => RyuLogger.Error,
+ _ => throw new ArgumentOutOfRangeException(nameof(level), level, null),
};
}
@@ -45,7 +47,7 @@ namespace Ryujinx.Ava.UI.Helpers
GetLog(level)?.PrintMsg(RyuLogClass.Ui, Format(level, area, messageTemplate, source, new object[] { propertyValue0 }));
}
- public void Log<T0, T1>(AvaLogLevel level, string area, object source, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ public void Log<T0, T1>(AvaLogLevel level, string area, object source, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
{
GetLog(level)?.PrintMsg(RyuLogClass.Ui, Format(level, area, messageTemplate, source, new object[] { propertyValue0, propertyValue1 }));
}
@@ -112,4 +114,4 @@ namespace Ryujinx.Ava.UI.Helpers
return result.ToString();
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/MiniCommand.cs b/src/Ryujinx.Ava/UI/Helpers/MiniCommand.cs
index 305182c9..864f53b8 100644
--- a/src/Ryujinx.Ava/UI/Helpers/MiniCommand.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/MiniCommand.cs
@@ -8,7 +8,7 @@ namespace Ryujinx.Ava.UI.Helpers
{
private readonly Action<T> _callback;
private bool _busy;
- private Func<T, Task> _asyncCallback;
+ private readonly Func<T, Task> _asyncCallback;
public MiniCommand(Action<T> callback)
{
@@ -68,4 +68,4 @@ namespace Ryujinx.Ava.UI.Helpers
public abstract void Execute(object parameter);
public abstract event EventHandler CanExecuteChanged;
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/NotificationHelper.cs b/src/Ryujinx.Ava/UI/Helpers/NotificationHelper.cs
index f207c5fb..a11fb526 100644
--- a/src/Ryujinx.Ava/UI/Helpers/NotificationHelper.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/NotificationHelper.cs
@@ -12,12 +12,12 @@ namespace Ryujinx.Ava.UI.Helpers
{
public static class NotificationHelper
{
- private const int MaxNotifications = 4;
+ private const int MaxNotifications = 4;
private const int NotificationDelayInMs = 5000;
private static WindowNotificationManager _notificationManager;
- private static readonly BlockingCollection<Notification> _notifications = new();
+ private static readonly BlockingCollection<Notification> _notifications = new();
public static void SetNotificationManager(Window host)
{
@@ -25,7 +25,7 @@ namespace Ryujinx.Ava.UI.Helpers
{
Position = NotificationPosition.BottomRight,
MaxItems = MaxNotifications,
- Margin = new Thickness(0, 0, 15, 40)
+ Margin = new Thickness(0, 0, 15, 40),
};
var maybeAsyncWorkQueue = new Lazy<AsyncWorkQueue<Notification>>(
@@ -67,4 +67,4 @@ namespace Ryujinx.Ava.UI.Helpers
Show(LocaleManager.Instance[LocaleKeys.DialogErrorTitle], $"{LocaleManager.Instance[LocaleKeys.DialogErrorMessage]}\n\n{message}", NotificationType.Error);
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/NullableDateTimeConverter.cs b/src/Ryujinx.Ava/UI/Helpers/NullableDateTimeConverter.cs
index 1d862de0..e9193761 100644
--- a/src/Ryujinx.Ava/UI/Helpers/NullableDateTimeConverter.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/NullableDateTimeConverter.cs
@@ -35,4 +35,4 @@ namespace Ryujinx.Ava.UI.Helpers
return _instance;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/OffscreenTextBox.cs b/src/Ryujinx.Ava/UI/Helpers/OffscreenTextBox.cs
index 785e785c..670d3b36 100644
--- a/src/Ryujinx.Ava/UI/Helpers/OffscreenTextBox.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/OffscreenTextBox.cs
@@ -6,12 +6,12 @@ namespace Ryujinx.Ava.UI.Helpers
{
public class OffscreenTextBox : TextBox
{
- public RoutedEvent<KeyEventArgs> GetKeyDownRoutedEvent()
+ public static RoutedEvent<KeyEventArgs> GetKeyDownRoutedEvent()
{
return KeyDownEvent;
}
- public RoutedEvent<KeyEventArgs> GetKeyUpRoutedEvent()
+ public static RoutedEvent<KeyEventArgs> GetKeyUpRoutedEvent()
{
return KeyUpEvent;
}
@@ -28,13 +28,13 @@ namespace Ryujinx.Ava.UI.Helpers
public void SendText(string text)
{
- OnTextInput(new TextInputEventArgs()
+ OnTextInput(new TextInputEventArgs
{
Text = text,
Device = KeyboardDevice.Instance,
Source = this,
- RoutedEvent = TextInputEvent
+ RoutedEvent = TextInputEvent,
});
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/UserErrorDialog.cs b/src/Ryujinx.Ava/UI/Helpers/UserErrorDialog.cs
index 4ed629ff..afd2958c 100644
--- a/src/Ryujinx.Ava/UI/Helpers/UserErrorDialog.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/UserErrorDialog.cs
@@ -1,5 +1,4 @@
using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Ava.UI.Windows;
using Ryujinx.Ui.Common;
using Ryujinx.Ui.Common.Helper;
using System.Threading.Tasks;
@@ -24,7 +23,7 @@ namespace Ryujinx.Ava.UI.Helpers
UserError.FirmwareParsingFailed => LocaleManager.Instance[LocaleKeys.UserErrorFirmwareParsingFailed],
UserError.ApplicationNotFound => LocaleManager.Instance[LocaleKeys.UserErrorApplicationNotFound],
UserError.Unknown => LocaleManager.Instance[LocaleKeys.UserErrorUnknown],
- _ => LocaleManager.Instance[LocaleKeys.UserErrorUndefined]
+ _ => LocaleManager.Instance[LocaleKeys.UserErrorUndefined],
};
}
@@ -37,7 +36,7 @@ namespace Ryujinx.Ava.UI.Helpers
UserError.FirmwareParsingFailed => LocaleManager.Instance[LocaleKeys.UserErrorFirmwareParsingFailedDescription],
UserError.ApplicationNotFound => LocaleManager.Instance[LocaleKeys.UserErrorApplicationNotFoundDescription],
UserError.Unknown => LocaleManager.Instance[LocaleKeys.UserErrorUnknownDescription],
- _ => LocaleManager.Instance[LocaleKeys.UserErrorUndefinedDescription]
+ _ => LocaleManager.Instance[LocaleKeys.UserErrorUndefinedDescription],
};
}
@@ -48,7 +47,7 @@ namespace Ryujinx.Ava.UI.Helpers
UserError.NoKeys or
UserError.NoFirmware or
UserError.FirmwareParsingFailed => true,
- _ => false
+ _ => false,
};
}
@@ -63,11 +62,11 @@ namespace Ryujinx.Ava.UI.Helpers
{
UserError.NoKeys => SetupGuideUrl + "#initial-setup---placement-of-prodkeys",
UserError.NoFirmware => SetupGuideUrl + "#initial-setup-continued---installation-of-firmware",
- _ => SetupGuideUrl
+ _ => SetupGuideUrl,
};
}
- public static async Task ShowUserErrorDialog(UserError error, StyleableWindow owner)
+ public static async Task ShowUserErrorDialog(UserError error)
{
string errorCode = GetErrorCode(error);
@@ -88,4 +87,4 @@ namespace Ryujinx.Ava.UI.Helpers
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/UserResult.cs b/src/Ryujinx.Ava/UI/Helpers/UserResult.cs
index 57802804..2fcd35ae 100644
--- a/src/Ryujinx.Ava/UI/Helpers/UserResult.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/UserResult.cs
@@ -9,4 +9,4 @@ namespace Ryujinx.Ava.UI.Helpers
Cancel,
None,
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs b/src/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs
index 03d3a49f..ca55d039 100644
--- a/src/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs
@@ -1,4 +1,5 @@
using System;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
@@ -10,46 +11,47 @@ namespace Ryujinx.Ava.UI.Helpers
[Flags]
public enum ClassStyles : uint
{
- CS_CLASSDC = 0x40,
- CS_OWNDC = 0x20,
+ CsClassdc = 0x40,
+ CsOwndc = 0x20,
}
[Flags]
public enum WindowStyles : uint
{
- WS_CHILD = 0x40000000
+ WsChild = 0x40000000,
}
public enum Cursors : uint
{
- IDC_ARROW = 32512
+ IdcArrow = 32512,
}
+ [SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
public enum WindowsMessages : uint
{
- MOUSEMOVE = 0x0200,
- LBUTTONDOWN = 0x0201,
- LBUTTONUP = 0x0202,
- LBUTTONDBLCLK = 0x0203,
- RBUTTONDOWN = 0x0204,
- RBUTTONUP = 0x0205,
- RBUTTONDBLCLK = 0x0206,
- MBUTTONDOWN = 0x0207,
- MBUTTONUP = 0x0208,
- MBUTTONDBLCLK = 0x0209,
- MOUSEWHEEL = 0x020A,
- XBUTTONDOWN = 0x020B,
- XBUTTONUP = 0x020C,
- XBUTTONDBLCLK = 0x020D,
- MOUSEHWHEEL = 0x020E,
- MOUSELAST = 0x020E
+ Mousemove = 0x0200,
+ Lbuttondown = 0x0201,
+ Lbuttonup = 0x0202,
+ Lbuttondblclk = 0x0203,
+ Rbuttondown = 0x0204,
+ Rbuttonup = 0x0205,
+ Rbuttondblclk = 0x0206,
+ Mbuttondown = 0x0207,
+ Mbuttonup = 0x0208,
+ Mbuttondblclk = 0x0209,
+ Mousewheel = 0x020A,
+ Xbuttondown = 0x020B,
+ Xbuttonup = 0x020C,
+ Xbuttondblclk = 0x020D,
+ Mousehwheel = 0x020E,
+ Mouselast = 0x020E,
}
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
internal delegate IntPtr WindowProc(IntPtr hWnd, WindowsMessages msg, IntPtr wParam, IntPtr lParam);
[StructLayout(LayoutKind.Sequential)]
- public struct WNDCLASSEX
+ public struct WndClassEx
{
public int cbSize;
public ClassStyles style;
@@ -64,9 +66,9 @@ namespace Ryujinx.Ava.UI.Helpers
public IntPtr lpszClassName;
public IntPtr hIconSm;
- public WNDCLASSEX()
+ public WndClassEx()
{
- cbSize = Marshal.SizeOf<WNDCLASSEX>();
+ cbSize = Marshal.SizeOf<WndClassEx>();
}
}
@@ -77,17 +79,17 @@ namespace Ryujinx.Ava.UI.Helpers
public static IntPtr CreateArrowCursor()
{
- return LoadCursor(IntPtr.Zero, (IntPtr)Cursors.IDC_ARROW);
+ return LoadCursor(IntPtr.Zero, (IntPtr)Cursors.IdcArrow);
}
[LibraryImport("user32.dll")]
public static partial IntPtr SetCursor(IntPtr handle);
[LibraryImport("user32.dll")]
- public static partial IntPtr CreateCursor(IntPtr hInst, int xHotSpot, int yHotSpot, int nWidth, int nHeight, byte[] pvANDPlane, byte[] pvXORPlane);
+ public static partial IntPtr CreateCursor(IntPtr hInst, int xHotSpot, int yHotSpot, int nWidth, int nHeight, byte[] pvAndPlane, byte[] pvXorPlane);
[LibraryImport("user32.dll", SetLastError = true, EntryPoint = "RegisterClassExW")]
- public static partial ushort RegisterClassEx(ref WNDCLASSEX param);
+ public static partial ushort RegisterClassEx(ref WndClassEx param);
[LibraryImport("user32.dll", SetLastError = true, EntryPoint = "UnregisterClassW")]
public static partial short UnregisterClass([MarshalAs(UnmanagedType.LPWStr)] string lpClassName, IntPtr instance);