Open Project
To open a project, use the OpenProject
method of the IWorkspace
object. For UI interaction, you can display a dialog by using the ShowOpenFileDialog
method of the ICommonUI
object.
public void OpenProject(ICommandContext c, ICommandParams p)
{
//Select a project file
var filePath = c.App.Window.UI.ShowOpenFileDialog("Please select a project file.", "Project file|*.iproj;*.nproj");
if ( filePath == null ) return "Cancelled.";
//Open a project file
c.App.Workspace.OpenProject(filePath);
}