From a3ab1578cd8806151bf52a078027f0fe56135740 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Fri, 7 Feb 2020 18:00:03 +0300 Subject: [PATCH] Removed C# 8.0 feature usage --- .../Platform/DefaultMenuInteractionHandler.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs b/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs index 31c62dec28..8af71a6c1f 100644 --- a/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs +++ b/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs @@ -14,8 +14,8 @@ namespace Avalonia.Controls.Platform public class DefaultMenuInteractionHandler : IMenuInteractionHandler { private readonly bool _isContextMenu; - private IDisposable? _inputManagerSubscription; - private IRenderRoot? _root; + private IDisposable _inputManagerSubscription; + private IRenderRoot _root; public DefaultMenuInteractionHandler(bool isContextMenu) : this(isContextMenu, Input.InputManager.Instance, DefaultDelayRun) @@ -24,7 +24,7 @@ namespace Avalonia.Controls.Platform public DefaultMenuInteractionHandler( bool isContextMenu, - IInputManager? inputManager, + IInputManager inputManager, Action delayRun) { delayRun = delayRun ?? throw new ArgumentNullException(nameof(delayRun)); @@ -94,7 +94,7 @@ namespace Avalonia.Controls.Platform root.Deactivated -= WindowDeactivated; } - _inputManagerSubscription!.Dispose(); + _inputManagerSubscription.Dispose(); Menu = null; _root = null; @@ -102,9 +102,9 @@ namespace Avalonia.Controls.Platform protected Action DelayRun { get; } - protected IInputManager? InputManager { get; } + protected IInputManager InputManager { get; } - protected IMenu? Menu { get; private set; } + protected IMenu Menu { get; private set; } protected static TimeSpan MenuShowDelay { get; } = TimeSpan.FromMilliseconds(400); @@ -133,7 +133,7 @@ namespace Avalonia.Controls.Platform KeyDown(GetMenuItem(e.Source as IControl), e); } - protected internal virtual void KeyDown(IMenuItem? item, KeyEventArgs e) + protected internal virtual void KeyDown(IMenuItem item, KeyEventArgs e) { switch (e.Key) { @@ -202,7 +202,7 @@ namespace Avalonia.Controls.Platform } else { - Menu!.Close(); + Menu.Close(); } e.Handled = true; @@ -215,7 +215,7 @@ namespace Avalonia.Controls.Platform { if (item == null && _isContextMenu) { - if (Menu!.MoveSelection(direction.Value, true) == true) + if (Menu.MoveSelection(direction.Value, true) == true) { e.Handled = true; } @@ -410,7 +410,7 @@ namespace Avalonia.Controls.Platform protected void CloseMenu(IMenuItem item) { - var current = (IMenuElement?)item; + var current = (IMenuElement)item; while (current != null && !(current is IMenu)) { @@ -458,7 +458,7 @@ namespace Avalonia.Controls.Platform protected void SelectItemAndAncestors(IMenuItem item) { - var current = (IMenuItem?)item; + var current = item; while (current?.Parent != null) { @@ -467,7 +467,7 @@ namespace Avalonia.Controls.Platform } } - protected static IMenuItem? GetMenuItem(IControl? item) + protected static IMenuItem GetMenuItem(IControl item) { while (true) {