diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-01-20 19:32:53 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2014-10-21 18:39:14 +0400 |
commit | f73b2a9990495587d514aa1856919c21170a3940 (patch) | |
tree | 9842411ee8644ead5915a715ee7e53984a601df4 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs | |
parent | a2046b6331a271e8203df7d3d0f14500d33d60fa (diff) |
Initial drop of the new project model
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs index 9640135723..796235af41 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs @@ -46,6 +46,7 @@ using MonoDevelop.Ide.Codons; using MonoDevelop.Projects; using MonoDevelop.Ide.Gui; using System.Linq; +using System.Threading.Tasks; namespace MonoDevelop.Ide.Templates { @@ -217,17 +218,18 @@ namespace MonoDevelop.Ide.Templates } //methods - public IAsyncOperation OpenCreatedSolution () + public Task<bool> OpenCreatedSolution () { - IAsyncOperation asyncOperation = IdeApp.Workspace.OpenWorkspaceItem (createdSolutionName); - asyncOperation.Completed += delegate { - if (asyncOperation.Success) { + var asyncOperation = IdeApp.Workspace.OpenWorkspaceItem (createdSolutionName); + return asyncOperation.ContinueWith (t => { + if (t.Result) { foreach (string action in actions) { IdeApp.Workbench.OpenDocument (Path.Combine (createdProjectInformation.ProjectBasePath, action)); } + return true; } - }; - return asyncOperation; + return false; + }); } public WorkspaceItem CreateWorkspaceItem (ProjectCreateInformation cInfo) @@ -241,13 +243,13 @@ namespace MonoDevelop.Ide.Templates return workspaceItemInfo.WorkspaceItem; } - public SolutionEntityItem CreateProject (SolutionItem policyParent, ProjectCreateInformation cInfo) + public SolutionItem CreateProject (SolutionFolderItem policyParent, ProjectCreateInformation cInfo) { if (solutionDescriptor.EntryDescriptors.Length == 0) throw new InvalidOperationException ("Solution template doesn't have any project templates"); ISolutionItemDescriptor descriptor = solutionDescriptor.EntryDescriptors [0]; - SolutionEntityItem solutionEntryItem = descriptor.CreateItem (cInfo, this.languagename); + SolutionItem solutionEntryItem = descriptor.CreateItem (cInfo, this.languagename); descriptor.InitializeItem (policyParent, cInfo, this.languagename, solutionEntryItem); SavePackageReferences (solutionEntryItem, descriptor); @@ -257,7 +259,7 @@ namespace MonoDevelop.Ide.Templates return solutionEntryItem; } - void SavePackageReferences (SolutionEntityItem solutionEntryItem, ISolutionItemDescriptor descriptor) + void SavePackageReferences (SolutionItem solutionEntryItem, ISolutionItemDescriptor descriptor) { packageReferencesForCreatedProjects = new List<PackageReferencesForCreatedProject> (); if ((solutionEntryItem is Project) && (descriptor is ProjectDescriptor)) { |