コマンドハンドラの実装
リボンのボタンやショートカットキーに対してコマンドを実装することで振る舞いを実装します。コマンドはCommandHandlerBaseを継承して実装します。
CommandHandlerBaseクラス内ではApp CurrentProjectなどにアクセス可能です。
コマンドの実装例
using NextDesign.Desktop;
using NextDesign.Desktop.ExtensionPoints;
namespace SampleExtension.Commands
{
    /// <summary>
    /// Hello コマンドの実装です。
    /// </summary>
    public class HelloCommand : CommandHandlerBase
    {
        /// <summary>
        /// コマンドの実行
        /// </summary>
        /// <param name="c"></param>
        /// <param name="p"></param>
        protected override void OnExecute(ICommandContext c, ICommandParams p)
        {
            if ( CurrentProject != null)
            {
                Output.WriteLine(ExtensionName, $"ProjectName : {CurrentProject.Name}");
            } else
            {
                Output.WriteLine(ExtensionName,$"Project is not opened");
            }
            // アクティブにします
            App.Window.IsInformationPaneVisible = true;
            App.Window.CurrentOutputCategory = ExtensionName;
            App.Window.ActiveInfoWindow = "Output";
        }
    }
}
コマンドの実行可否
コマンドの実行可否はOnCanExecuteのオーバーライドにより実装できます。この結果はリボンのボタンの有効無効判定と連動します。実装しない場合は常にtrueとなります。
public class HelloCommand : CommandHandlerBase
{
    /// <summary>
    /// コマンドの実行可否の判断
    /// </summary>
    /// <returns>コマンドが有効な場合はtrue</returns>
    protected override bool OnCanExecute()
    {
        return true;
    }
}