Table of Contents

Class Command

Namespace
Whim
Assembly
Whim.dll
Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.
public class Command : ICommand
Inheritance
Command
Implements
Inherited Members

Constructors

Command(string, string, Action, Func<bool>?)

Initializes a new instance of the Command class.
public Command(string identifier, string title, Action callback, Func<bool>? condition = null)

Parameters

identifier string
The identifier of the command.
title string
The title of the command.
callback Action
The callback to execute. This can include triggering a menu to be shown by Whim.CommandPalette, or to perform some other action.
condition Func<bool>
A condition to determine if the command should be visible, or able to be executed. When this evaluates to false, the callback will not be executed. If this is null, the command will always be accessible.

Properties

Id

The unique identifier. For example, "whim.core.focus_right_window".
public string Id { get; }

Property Value

string

Title

The title of the command. For example, "Focus right window".
public string Title { get; }

Property Value

string

Methods

CanExecute()

Indicates whether the command can currently be executed.
public bool CanExecute()

Returns

bool

ToString()

Returns a string that represents the current object.
public override string ToString()

Returns

string
A string that represents the current object.

TryExecute()

Tries to execute the command. If the command is not executable (due to the condition not being met), false is returned.
public bool TryExecute()

Returns

bool
True if the command was executed, false otherwise.