ICommandContext.cs 1.0 KB

123456789101112131415161718192021222324
  1. 
  2. namespace Terminal.Gui.Input;
  3. #pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
  4. /// <summary>
  5. /// Describes the context in which a <see cref="Command"/> is being invoked. <see cref="CommandContext{TBindingType}"/> inherits from this interface.
  6. /// When a <see cref="Command"/> is invoked,
  7. /// a context object is passed to Command handlers as an <see cref="ICommandContext"/> reference.
  8. /// </summary>
  9. /// <seealso cref="View.AddCommand(Command, View.CommandImplementation)"/>.
  10. #pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved
  11. public interface ICommandContext
  12. {
  13. /// <summary>
  14. /// The <see cref="Command"/> that is being invoked.
  15. /// </summary>
  16. public Command Command { get; set; }
  17. /// <summary>
  18. /// The View that was the source of the command invocation, if any.
  19. /// (e.g. the view the user clicked on or the view that had focus when a key was pressed).
  20. /// </summary>
  21. public View? Source { get; set; }
  22. }