-
Notifications
You must be signed in to change notification settings - Fork 19
Commands
Daniel Cazzulino edited this page Jan 9, 2014
·
2 revisions
Clide provides easy Visual Studio commands programming by automatically discovering and registering command implementations as well as automatically injecting dependencies they may have on other Clide or your own custom components.
This is a sample command that shows how to take a dependency on Clide IDevEnv via the command constructor, and how to traverse the solution and count all nodes:
[Command(Constants.CommandSet, Constants.cmdHelloClide)]
public class SampleCommand : ICommandExtension
{
private IDevEnv devEnv;
public SampleCommand(IDevEnv devEnv)
{
this.devEnv = devEnv;
}
public string Text
{
get { return "Sample"; }
}
public void Execute(IMenuCommand command)
{
var items = devEnv.SolutionExplorer()
.Solution
.Traverse()
.Count();
devEnv.MessageBoxService.ShowInformation(string.Format(
"Clide Version: {0}, Solution Nodes: {1}",
typeof(IDevEnv).Assembly.GetName().Version,
items));
}
public void QueryStatus(IMenuCommand command)
{
command.Enabled = command.Visible = true;
}
}