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/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployOperations.cs | |
parent | a2046b6331a271e8203df7d3d0f14500d33d60fa (diff) |
Initial drop of the new project model
Diffstat (limited to 'main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployOperations.cs')
-rw-r--r-- | main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployOperations.cs | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployOperations.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployOperations.cs index 1f877eef1d..74fab9ef93 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployOperations.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployOperations.cs @@ -3,14 +3,15 @@ using System.Collections; using MonoDevelop.Core; using MonoDevelop.Ide; using MonoDevelop.Projects; +using System.Threading.Tasks; namespace MonoDevelop.Deployment.Gui { public static class DeployOperations { - public static void Install (SolutionItem entry, ConfigurationSelector configuration) + public static void Install (SolutionFolderItem entry, ConfigurationSelector configuration) { - using (IProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor ()) { + using (ProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor ()) { InstallDialog dlg = new InstallDialog (entry); try { if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) @@ -21,36 +22,29 @@ namespace MonoDevelop.Deployment.Gui } } - public static IAsyncOperation BuildPackages (PackagingProject project) + public static Task BuildPackages (PackagingProject project) { return BuildPackages (project.Packages); } - static IAsyncOperation BuildPackages (ICollection packages) + static async Task BuildPackages (ICollection packages) { - IProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetToolOutputProgressMonitor (true); + ProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetToolOutputProgressMonitor (true); // Run the deploy command in a background thread to avoid // deadlocks with the gui thread - System.Threading.Thread t = new System.Threading.Thread ( - delegate () { - using (mon) { - mon.BeginTask ("Creating packages", packages.Count); - foreach (Package p in packages) { - DeployService.BuildPackage (mon, p); - mon.Step (1); - } - mon.EndTask (); + using (mon) { + mon.BeginTask ("Creating packages", packages.Count); + foreach (Package p in packages) { + await DeployService.BuildPackage (mon, p); + mon.Step (1); } - }); - t.IsBackground = true; - t.Start (); - - return mon.AsyncOperation; + mon.EndTask (); + } } - public static IAsyncOperation BuildPackage (Package package) + public static Task BuildPackage (Package package) { return BuildPackages (new object[] { package }); } @@ -59,7 +53,7 @@ namespace MonoDevelop.Deployment.Gui { EditPackageDialog dlg = new EditPackageDialog (package); if (MessageService.ShowCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) - IdeApp.ProjectOperations.Save (package.ParentProject); + IdeApp.ProjectOperations.SaveAsync (package.ParentProject); } } } |