diff --git a/src/Windows/Avalonia.Win32/TrayIconImpl.cs b/src/Windows/Avalonia.Win32/TrayIconImpl.cs index 2dbc844ab3..23395dd9b5 100644 --- a/src/Windows/Avalonia.Win32/TrayIconImpl.cs +++ b/src/Windows/Avalonia.Win32/TrayIconImpl.cs @@ -205,13 +205,12 @@ namespace Avalonia.Win32 }); } - class TrayIconManagedPopupPositionerPopupImplHelper : IManagedPopupPositionerPopup + private class TrayIconManagedPopupPositionerPopupImplHelper : IManagedPopupPositionerPopup { - public delegate void MoveResizeDelegate(PixelPoint position, Size size, double scaling); - private readonly MoveResizeDelegate _moveResize; + private readonly Action _moveResize; private readonly Window _hiddenWindow; - public TrayIconManagedPopupPositionerPopupImplHelper(MoveResizeDelegate moveResize) + public TrayIconManagedPopupPositionerPopupImplHelper(Action moveResize) { _moveResize = moveResize; _hiddenWindow = new Window(); diff --git a/src/Windows/Avalonia.Win32/Win32NativeToManagedMenuExporter.cs b/src/Windows/Avalonia.Win32/Win32NativeToManagedMenuExporter.cs index f8ae128725..7ac6e542ac 100644 --- a/src/Windows/Avalonia.Win32/Win32NativeToManagedMenuExporter.cs +++ b/src/Windows/Avalonia.Win32/Win32NativeToManagedMenuExporter.cs @@ -17,13 +17,11 @@ namespace Avalonia.Win32 private IEnumerable Populate (NativeMenu nativeMenu) { - var items = new List(); - foreach (var menuItem in nativeMenu.Items) { if (menuItem is NativeMenuItemSeparator) { - items.Add(new MenuItem { Header = "-" }); + yield return new MenuItem { Header = "-" }; } else if (menuItem is NativeMenuItem item) { @@ -35,14 +33,12 @@ namespace Avalonia.Win32 } else if (item.HasClickHandlers && item is INativeMenuItemExporterEventsImplBridge bridge) { - newItem.Click += (s, e) => bridge.RaiseClicked(); + newItem.Click += (_, __) => bridge.RaiseClicked(); } - items.Add(newItem); + yield return newItem; } } - - return items; } public IEnumerable? GetMenu ()