MonoDevelop: macros or running commands sequentially
I'm trying to create an add-in for MonoDevelop, which will run commands, triggered from external tools (ex: updating source, building and running project on incoming message from Jabber). Since I could not find macros, I use "commands", by calling them through IdeApp.CommandService.DispatchCommand(). For single action this works great, but when I try to run several commands sequentially, they are executed simultaneously. So, how to implement the command queue, where one command waits completion of previous?
DispatchCommand is synchronous, however some of the commands that it runs may start asynchronous operations, and the commands have no way to return a handle to those operations.
For those particular commands, I'd recommend that you don't dispatch them as commands but instead directly call the high-level APIs to perform those operations. For example, IdeApp.ProjectOperations.Build returns an IAsyncOperation handle that you can block on using its WaitForCompleted method. You can use IdeApp.Workspace to open projects and get handles to opened projects, set the active configuration, etc.