|
@@ -1,7 +1,4 @@
|
|
|
#nullable enable
|
|
|
-using System.ComponentModel;
|
|
|
-using System.Dynamic;
|
|
|
-
|
|
|
namespace Terminal.Gui;
|
|
|
|
|
|
public partial class View // Command APIs
|
|
@@ -22,7 +19,8 @@ public partial class View // Command APIs
|
|
|
AddCommand (Command.Accept, RaiseAccepting);
|
|
|
|
|
|
// HotKey - SetFocus and raise HandlingHotKey
|
|
|
- AddCommand (Command.HotKey,
|
|
|
+ AddCommand (
|
|
|
+ Command.HotKey,
|
|
|
() =>
|
|
|
{
|
|
|
if (RaiseHandlingHotKey () is true)
|
|
@@ -36,22 +34,24 @@ public partial class View // Command APIs
|
|
|
});
|
|
|
|
|
|
// Space or single-click - Raise Selecting
|
|
|
- AddCommand (Command.Select, ctx =>
|
|
|
- {
|
|
|
- if (RaiseSelecting (ctx) is true)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- if (CanFocus)
|
|
|
- {
|
|
|
- SetFocus ();
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
- });
|
|
|
+ AddCommand (
|
|
|
+ Command.Select,
|
|
|
+ ctx =>
|
|
|
+ {
|
|
|
+ if (RaiseSelecting (ctx) is true)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CanFocus)
|
|
|
+ {
|
|
|
+ SetFocus ();
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -59,18 +59,17 @@ public partial class View // Command APIs
|
|
|
/// </summary>
|
|
|
/// <returns>
|
|
|
/// <see langword="null"/> if no event was raised; input processing should continue.
|
|
|
- /// <see langword="false"/> if the event was raised and was not handled (or cancelled); input processing should continue.
|
|
|
+ /// <see langword="false"/> if the event was raised and was not handled (or cancelled); input processing should
|
|
|
+ /// continue.
|
|
|
/// <see langword="true"/> if the event was raised and handled (or cancelled); input processing should stop.
|
|
|
/// </returns>
|
|
|
protected bool? RaiseCommandNotBound (ICommandContext? ctx)
|
|
|
{
|
|
|
CommandEventArgs args = new () { Context = ctx };
|
|
|
|
|
|
- // Best practice is to invoke the virtual method first.
|
|
|
- // This allows derived classes to handle the event and potentially cancel it.
|
|
|
// For robustness' sake, even if the virtual method returns true, if the args
|
|
|
// indicate the event should be cancelled, we honor that.
|
|
|
- if (OnCommandNotBound (args) || args.Cancel)
|
|
|
+ if (OnCommandNotBound (args) || args.Handled)
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
@@ -78,13 +77,13 @@ public partial class View // Command APIs
|
|
|
// If the event is not canceled by the virtual method, raise the event to notify any external subscribers.
|
|
|
CommandNotBound?.Invoke (this, args);
|
|
|
|
|
|
- return CommandNotBound is null ? null : args.Cancel;
|
|
|
+ return CommandNotBound is null ? null : args.Handled;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Called when a command that has not been bound is invoked.
|
|
|
- /// Set CommandEventArgs.Cancel to
|
|
|
- /// <see langword="true"/> and return <see langword="true"/> to cancel the event. The default implementation does nothing.
|
|
|
+ /// Called when a command that has not been bound is invoked.
|
|
|
+ /// Set CommandEventArgs.Handled to <see langword="true"/> and return <see langword="true"/> to indicate the event was
|
|
|
+ /// handled and processing should stop.
|
|
|
/// </summary>
|
|
|
/// <param name="args">The event arguments.</param>
|
|
|
/// <returns><see langword="true"/> to stop processing.</returns>
|
|
@@ -92,28 +91,35 @@ public partial class View // Command APIs
|
|
|
|
|
|
/// <summary>
|
|
|
/// Cancelable event raised when a command that has not been bound is invoked.
|
|
|
+ /// Set CommandEventArgs.Handled to <see langword="true"/> to indicate the event was handled and processing should
|
|
|
+ /// stop.
|
|
|
/// </summary>
|
|
|
public event EventHandler<CommandEventArgs>? CommandNotBound;
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Called when the user is accepting the state of the View and the <see cref="Command.Accept"/> has been invoked. Calls <see cref="OnAccepting"/> which can be cancelled; if not cancelled raises <see cref="Accepting"/>.
|
|
|
+ /// Called when the user is accepting the state of the View and the <see cref="Command.Accept"/> has been invoked.
|
|
|
+ /// Calls <see cref="OnAccepting"/> which can be cancelled; if not cancelled raises <see cref="Accepting"/>.
|
|
|
/// event. The default <see cref="Command.Accept"/> handler calls this method.
|
|
|
/// </summary>
|
|
|
/// <remarks>
|
|
|
- /// <para>
|
|
|
- /// The <see cref="Accepting"/> event should be raised after the state of the View has changed (after <see cref="Selecting"/> is raised).
|
|
|
- /// </para>
|
|
|
- /// <para>
|
|
|
- /// If the Accepting event is not handled, <see cref="Command.Accept"/> will be invoked on the SuperView, enabling default Accept behavior.
|
|
|
- /// </para>
|
|
|
- /// <para>
|
|
|
- /// If a peer-View raises the Accepting event and the event is not cancelled, the <see cref="Command.Accept"/> will be invoked on the
|
|
|
- /// first Button in the SuperView that has <see cref="Button.IsDefault"/> set to <see langword="true"/>.
|
|
|
- /// </para>
|
|
|
+ /// <para>
|
|
|
+ /// The <see cref="Accepting"/> event should be raised after the state of the View has changed (after
|
|
|
+ /// <see cref="Selecting"/> is raised).
|
|
|
+ /// </para>
|
|
|
+ /// <para>
|
|
|
+ /// If the Accepting event is not handled, <see cref="Command.Accept"/> will be invoked on the SuperView, enabling
|
|
|
+ /// default Accept behavior.
|
|
|
+ /// </para>
|
|
|
+ /// <para>
|
|
|
+ /// If a peer-View raises the Accepting event and the event is not cancelled, the <see cref="Command.Accept"/> will
|
|
|
+ /// be invoked on the
|
|
|
+ /// first Button in the SuperView that has <see cref="Button.IsDefault"/> set to <see langword="true"/>.
|
|
|
+ /// </para>
|
|
|
/// </remarks>
|
|
|
/// <returns>
|
|
|
/// <see langword="null"/> if no event was raised; input processing should continue.
|
|
|
- /// <see langword="false"/> if the event was raised and was not handled (or cancelled); input processing should continue.
|
|
|
+ /// <see langword="false"/> if the event was raised and was not handled (or cancelled); input processing should
|
|
|
+ /// continue.
|
|
|
/// <see langword="true"/> if the event was raised and handled (or cancelled); input processing should stop.
|
|
|
/// </returns>
|
|
|
protected bool? RaiseAccepting (ICommandContext? ctx)
|
|
@@ -124,9 +130,9 @@ public partial class View // Command APIs
|
|
|
// Best practice is to invoke the virtual method first.
|
|
|
// This allows derived classes to handle the event and potentially cancel it.
|
|
|
Logging.Debug ($"{Title} ({ctx?.Source?.Title}) - Calling OnAccepting...");
|
|
|
- args.Cancel = OnAccepting (args) || args.Cancel;
|
|
|
+ args.Handled = OnAccepting (args) || args.Handled;
|
|
|
|
|
|
- if (!args.Cancel && Accepting is {})
|
|
|
+ if (!args.Handled && Accepting is { })
|
|
|
{
|
|
|
// If the event is not canceled by the virtual method, raise the event to notify any external subscribers.
|
|
|
Logging.Debug ($"{Title} ({ctx?.Source?.Title}) - Raising Accepting...");
|
|
@@ -136,10 +142,10 @@ public partial class View // Command APIs
|
|
|
// Accept is a special case where if the event is not canceled, the event is
|
|
|
// - Invoked on any peer-View with IsDefault == true
|
|
|
// - bubbled up the SuperView hierarchy.
|
|
|
- if (!args.Cancel)
|
|
|
+ if (!args.Handled)
|
|
|
{
|
|
|
// If there's an IsDefault peer view in SubViews, try it
|
|
|
- var isDefaultView = SuperView?.InternalSubViews.FirstOrDefault (v => v is Button { IsDefault: true });
|
|
|
+ View? isDefaultView = SuperView?.InternalSubViews.FirstOrDefault (v => v is Button { IsDefault: true });
|
|
|
|
|
|
if (isDefaultView != this && isDefaultView is Button { IsDefault: true } button)
|
|
|
{
|
|
@@ -147,7 +153,8 @@ public partial class View // Command APIs
|
|
|
// TODO: is generic?
|
|
|
|
|
|
Logging.Debug ($"{Title} ({ctx?.Source?.Title}) - InvokeCommand on Default View ({isDefaultView.Title})");
|
|
|
- bool ? handled = isDefaultView.InvokeCommand (Command.Accept, ctx);
|
|
|
+ bool? handled = isDefaultView.InvokeCommand (Command.Accept, ctx);
|
|
|
+
|
|
|
if (handled == true)
|
|
|
{
|
|
|
return true;
|
|
@@ -157,47 +164,54 @@ public partial class View // Command APIs
|
|
|
if (SuperView is { })
|
|
|
{
|
|
|
Logging.Debug ($"{Title} ({ctx?.Source?.Title}) - Invoking Accept on SuperView ({SuperView.Title}/{SuperView.Id})...");
|
|
|
+
|
|
|
return SuperView?.InvokeCommand (Command.Accept, ctx);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return args.Cancel;
|
|
|
+ return args.Handled;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Called when the user is accepting the state of the View and the <see cref="Command.Accept"/> has been invoked. Set CommandEventArgs.Cancel to
|
|
|
- /// <see langword="true"/> and return <see langword="true"/> to stop processing.
|
|
|
+ /// Called when the user is accepting the state of the View and the <see cref="Command.Accept"/> has been invoked.
|
|
|
+ /// Set CommandEventArgs.Handled to <see langword="true"/> and return <see langword="true"/> to indicate the event was
|
|
|
+ /// handled and processing should stop.
|
|
|
/// </summary>
|
|
|
/// <remarks>
|
|
|
- /// <para>
|
|
|
- /// See <see cref="View.RaiseAccepting"/> for more information.
|
|
|
- /// </para>
|
|
|
+ /// <para>
|
|
|
+ /// See <see cref="View.RaiseAccepting"/> for more information.
|
|
|
+ /// </para>
|
|
|
/// </remarks>
|
|
|
/// <param name="args"></param>
|
|
|
/// <returns><see langword="true"/> to stop processing.</returns>
|
|
|
protected virtual bool OnAccepting (CommandEventArgs args) { return false; }
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Cancelable event raised when the user is accepting the state of the View and the <see cref="Command.Accept"/> has been invoked. Set
|
|
|
- /// CommandEventArgs.Cancel to cancel the event.
|
|
|
+ /// Cancelable event raised when the user is accepting the state of the View and the <see cref="Command.Accept"/> has
|
|
|
+ /// been invoked.
|
|
|
+ /// Set CommandEventArgs.Handled to <see langword="true"/> to indicate the event was handled and processing should
|
|
|
+ /// stop.
|
|
|
/// </summary>
|
|
|
/// <remarks>
|
|
|
- /// <para>
|
|
|
- /// See <see cref="View.RaiseAccepting"/> for more information.
|
|
|
- /// </para>
|
|
|
+ /// <para>
|
|
|
+ /// See <see cref="View.RaiseAccepting"/> for more information.
|
|
|
+ /// </para>
|
|
|
/// </remarks>
|
|
|
public event EventHandler<CommandEventArgs>? Accepting;
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Called when the user has performed an action (e.g. <see cref="Command.Select"/>) causing the View to change state. Calls <see cref="OnSelecting"/> which can be cancelled; if not cancelled raises <see cref="Accepting"/>.
|
|
|
+ /// Called when the user has performed an action (e.g. <see cref="Command.Select"/>) causing the View to change state.
|
|
|
+ /// Calls <see cref="OnSelecting"/> which can be cancelled; if not cancelled raises <see cref="Accepting"/>.
|
|
|
/// event. The default <see cref="Command.Select"/> handler calls this method.
|
|
|
/// </summary>
|
|
|
/// <remarks>
|
|
|
- /// The <see cref="Selecting"/> event should be raised after the state of the View has been changed and before see <see cref="Accepting"/>.
|
|
|
+ /// The <see cref="Selecting"/> event should be raised after the state of the View has been changed and before see
|
|
|
+ /// <see cref="Accepting"/>.
|
|
|
/// </remarks>
|
|
|
/// <returns>
|
|
|
/// <see langword="null"/> if no event was raised; input processing should continue.
|
|
|
- /// <see langword="false"/> if the event was raised and was not handled (or cancelled); input processing should continue.
|
|
|
+ /// <see langword="false"/> if the event was raised and was not handled (or cancelled); input processing should
|
|
|
+ /// continue.
|
|
|
/// <see langword="true"/> if the event was raised and handled (or cancelled); input processing should stop.
|
|
|
/// </returns>
|
|
|
protected bool? RaiseSelecting (ICommandContext? ctx)
|
|
@@ -207,7 +221,7 @@ public partial class View // Command APIs
|
|
|
|
|
|
// Best practice is to invoke the virtual method first.
|
|
|
// This allows derived classes to handle the event and potentially cancel it.
|
|
|
- if (OnSelecting (args) || args.Cancel)
|
|
|
+ if (OnSelecting (args) || args.Handled)
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
@@ -215,41 +229,45 @@ public partial class View // Command APIs
|
|
|
// If the event is not canceled by the virtual method, raise the event to notify any external subscribers.
|
|
|
Selecting?.Invoke (this, args);
|
|
|
|
|
|
- return Selecting is null ? null : args.Cancel;
|
|
|
+ return Selecting is null ? null : args.Handled;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// Called when the user has performed an action (e.g. <see cref="Command.Select"/>) causing the View to change state.
|
|
|
- /// Set CommandEventArgs.Cancel to
|
|
|
- /// <see langword="true"/> and return <see langword="true"/> to cancel the state change. The default implementation does nothing.
|
|
|
+ /// Set CommandEventArgs.Handled to <see langword="true"/> and return <see langword="true"/> to indicate the event was
|
|
|
+ /// handled and processing should stop.
|
|
|
/// </summary>
|
|
|
/// <param name="args">The event arguments.</param>
|
|
|
/// <returns><see langword="true"/> to stop processing.</returns>
|
|
|
protected virtual bool OnSelecting (CommandEventArgs args) { return false; }
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Cancelable event raised when the user has performed an action (e.g. <see cref="Command.Select"/>) causing the View to change state.
|
|
|
- /// CommandEventArgs.Cancel to <see langword="true"/> to cancel the state change.
|
|
|
+ /// Cancelable event raised when the user has performed an action (e.g. <see cref="Command.Select"/>) causing the View
|
|
|
+ /// to change state.
|
|
|
+ /// Set CommandEventArgs.Handled to <see langword="true"/> to indicate the event was handled and processing should
|
|
|
+ /// stop.
|
|
|
/// </summary>
|
|
|
public event EventHandler<CommandEventArgs>? Selecting;
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Called when the View is handling the user pressing the View's <see cref="HotKey"/>s. Calls <see cref="OnHandlingHotKey"/> which can be cancelled; if not cancelled raises <see cref="Accepting"/>.
|
|
|
+ /// Called when the View is handling the user pressing the View's <see cref="HotKey"/>s. Calls
|
|
|
+ /// <see cref="OnHandlingHotKey"/> which can be cancelled; if not cancelled raises <see cref="Accepting"/>.
|
|
|
/// event. The default <see cref="Command.HotKey"/> handler calls this method.
|
|
|
/// </summary>
|
|
|
/// <returns>
|
|
|
/// <see langword="null"/> if no event was raised; input processing should continue.
|
|
|
- /// <see langword="false"/> if the event was raised and was not handled (or cancelled); input processing should continue.
|
|
|
+ /// <see langword="false"/> if the event was raised and was not handled (or cancelled); input processing should
|
|
|
+ /// continue.
|
|
|
/// <see langword="true"/> if the event was raised and handled (or cancelled); input processing should stop.
|
|
|
/// </returns>
|
|
|
protected bool? RaiseHandlingHotKey ()
|
|
|
{
|
|
|
- CommandEventArgs args = new () { Context = new CommandContext<KeyBinding> () { Command = Command.HotKey } };
|
|
|
+ CommandEventArgs args = new () { Context = new CommandContext<KeyBinding> { Command = Command.HotKey } };
|
|
|
Logging.Debug ($"{Title} ({args.Context?.Source?.Title})");
|
|
|
|
|
|
// Best practice is to invoke the virtual method first.
|
|
|
// This allows derived classes to handle the event and potentially cancel it.
|
|
|
- if (OnHandlingHotKey (args) || args.Cancel)
|
|
|
+ if (OnHandlingHotKey (args) || args.Handled)
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
@@ -257,12 +275,13 @@ public partial class View // Command APIs
|
|
|
// If the event is not canceled by the virtual method, raise the event to notify any external subscribers.
|
|
|
HandlingHotKey?.Invoke (this, args);
|
|
|
|
|
|
- return HandlingHotKey is null ? null : args.Cancel;
|
|
|
+ return HandlingHotKey is null ? null : args.Handled;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Called when the View is handling the user pressing the View's <see cref="HotKey"/>. Set CommandEventArgs.Cancel to
|
|
|
- /// <see langword="true"/> to stop processing.
|
|
|
+ /// Called when the View is handling the user pressing the View's <see cref="HotKey"/>.
|
|
|
+ /// Set CommandEventArgs.Handled to <see langword="true"/> to indicate the event was handled and processing should
|
|
|
+ /// stop.
|
|
|
/// </summary>
|
|
|
/// <param name="args"></param>
|
|
|
/// <returns><see langword="true"/> to stop processing.</returns>
|
|
@@ -270,19 +289,20 @@ public partial class View // Command APIs
|
|
|
|
|
|
/// <summary>
|
|
|
/// Cancelable event raised when the View is handling the user pressing the View's <see cref="HotKey"/>. Set
|
|
|
- /// CommandEventArgs.Cancel to cancel the event.
|
|
|
+ /// CommandEventArgs.Handled to <see langword="true"/> to indicate the event was handled and processing should stop.
|
|
|
/// </summary>
|
|
|
public event EventHandler<CommandEventArgs>? HandlingHotKey;
|
|
|
|
|
|
#endregion Default Implementation
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Function signature commands.
|
|
|
+ /// Function signature commands.
|
|
|
/// </summary>
|
|
|
/// <param name="ctx">Provides context about the circumstances of invoking the command.</param>
|
|
|
/// <returns>
|
|
|
/// <see langword="null"/> if no event was raised; input processing should continue.
|
|
|
- /// <see langword="false"/> if the event was raised and was not handled (or cancelled); input processing should continue.
|
|
|
+ /// <see langword="false"/> if the event was raised and was not handled (or cancelled); input processing should
|
|
|
+ /// continue.
|
|
|
/// <see langword="true"/> if the event was raised and handled (or cancelled); input processing should stop.
|
|
|
/// </returns>
|
|
|
public delegate bool? CommandImplementation (ICommandContext? ctx);
|
|
@@ -344,8 +364,10 @@ public partial class View // Command APIs
|
|
|
/// <param name="binding">The binding that caused the invocation, if any. This will be passed as context with the command.</param>
|
|
|
/// <returns>
|
|
|
/// <see langword="null"/> if no command was found; input processing should continue.
|
|
|
- /// <see langword="false"/> if the command was invoked and was not handled (or cancelled); input processing should continue.
|
|
|
- /// <see langword="true"/> if the command was invoked the command was handled (or cancelled); input processing should stop.
|
|
|
+ /// <see langword="false"/> if the command was invoked and was not handled (or cancelled); input processing should
|
|
|
+ /// continue.
|
|
|
+ /// <see langword="true"/> if the command was invoked the command was handled (or cancelled); input processing should
|
|
|
+ /// stop.
|
|
|
/// </returns>
|
|
|
public bool? InvokeCommands<TBindingType> (Command [] commands, TBindingType binding)
|
|
|
{
|
|
@@ -359,7 +381,7 @@ public partial class View // Command APIs
|
|
|
}
|
|
|
|
|
|
// each command has its own return value
|
|
|
- bool? thisReturn = InvokeCommand<TBindingType> (command, binding);
|
|
|
+ bool? thisReturn = InvokeCommand (command, binding);
|
|
|
|
|
|
// if we haven't got anything yet, the current command result should be used
|
|
|
toReturn ??= thisReturn;
|
|
@@ -375,14 +397,16 @@ public partial class View // Command APIs
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Invokes the specified command.
|
|
|
+ /// Invokes the specified command.
|
|
|
/// </summary>
|
|
|
/// <param name="command">The command to invoke.</param>
|
|
|
/// <param name="binding">The binding that caused the invocation, if any. This will be passed as context with the command.</param>
|
|
|
/// <returns>
|
|
|
/// <see langword="null"/> if no command was found; input processing should continue.
|
|
|
- /// <see langword="false"/> if the command was invoked and was not handled (or cancelled); input processing should continue.
|
|
|
- /// <see langword="true"/> if the command was invoked the command was handled (or cancelled); input processing should stop.
|
|
|
+ /// <see langword="false"/> if the command was invoked and was not handled (or cancelled); input processing should
|
|
|
+ /// continue.
|
|
|
+ /// <see langword="true"/> if the command was invoked the command was handled (or cancelled); input processing should
|
|
|
+ /// stop.
|
|
|
/// </returns>
|
|
|
public bool? InvokeCommand<TBindingType> (Command command, TBindingType binding)
|
|
|
{
|
|
@@ -390,24 +414,27 @@ public partial class View // Command APIs
|
|
|
{
|
|
|
_commandImplementations.TryGetValue (Command.NotBound, out implementation);
|
|
|
}
|
|
|
- return implementation! (new CommandContext<TBindingType> ()
|
|
|
- {
|
|
|
- Command = command,
|
|
|
- Source = this,
|
|
|
- Binding = binding,
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
+ return implementation! (
|
|
|
+ new CommandContext<TBindingType>
|
|
|
+ {
|
|
|
+ Command = command,
|
|
|
+ Source = this,
|
|
|
+ Binding = binding
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Invokes the specified command.
|
|
|
+ /// Invokes the specified command.
|
|
|
/// </summary>
|
|
|
/// <param name="command">The command to invoke.</param>
|
|
|
/// <param name="ctx">The context to pass with the command.</param>
|
|
|
/// <returns>
|
|
|
/// <see langword="null"/> if no command was found; input processing should continue.
|
|
|
- /// <see langword="false"/> if the command was invoked and was not handled (or cancelled); input processing should continue.
|
|
|
- /// <see langword="true"/> if the command was invoked the command was handled (or cancelled); input processing should stop.
|
|
|
+ /// <see langword="false"/> if the command was invoked and was not handled (or cancelled); input processing should
|
|
|
+ /// continue.
|
|
|
+ /// <see langword="true"/> if the command was invoked the command was handled (or cancelled); input processing should
|
|
|
+ /// stop.
|
|
|
/// </returns>
|
|
|
public bool? InvokeCommand (Command command, ICommandContext? ctx)
|
|
|
{
|
|
@@ -415,17 +442,20 @@ public partial class View // Command APIs
|
|
|
{
|
|
|
_commandImplementations.TryGetValue (Command.NotBound, out implementation);
|
|
|
}
|
|
|
+
|
|
|
return implementation! (ctx);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Invokes the specified command without context.
|
|
|
+ /// Invokes the specified command without context.
|
|
|
/// </summary>
|
|
|
/// <param name="command">The command to invoke.</param>
|
|
|
/// <returns>
|
|
|
/// <see langword="null"/> if no command was found; input processing should continue.
|
|
|
- /// <see langword="false"/> if the command was invoked and was not handled (or cancelled); input processing should continue.
|
|
|
- /// <see langword="true"/> if the command was invoked the command was handled (or cancelled); input processing should stop.
|
|
|
+ /// <see langword="false"/> if the command was invoked and was not handled (or cancelled); input processing should
|
|
|
+ /// continue.
|
|
|
+ /// <see langword="true"/> if the command was invoked the command was handled (or cancelled); input processing should
|
|
|
+ /// stop.
|
|
|
/// </returns>
|
|
|
public bool? InvokeCommand (Command command)
|
|
|
{
|
|
@@ -434,12 +464,12 @@ public partial class View // Command APIs
|
|
|
_commandImplementations.TryGetValue (Command.NotBound, out implementation);
|
|
|
}
|
|
|
|
|
|
- return implementation! (new CommandContext<object> ()
|
|
|
- {
|
|
|
- Command = command,
|
|
|
- Source = this,
|
|
|
- Binding = null,
|
|
|
- });
|
|
|
-
|
|
|
+ return implementation! (
|
|
|
+ new CommandContext<object>
|
|
|
+ {
|
|
|
+ Command = command,
|
|
|
+ Source = this,
|
|
|
+ Binding = null
|
|
|
+ });
|
|
|
}
|
|
|
}
|