diff options
author | Rodrigo Moya <rodrigo.moya@xamarin.com> | 2019-07-19 13:54:49 +0300 |
---|---|---|
committer | Rodrigo Moya <rodrigo.moya@xamarin.com> | 2019-07-25 12:31:12 +0300 |
commit | d0bb1eb20d7fcad630b6cec32c24bb9f9dee1fd6 (patch) | |
tree | f743caf83605f400b46854b70b8d67ccff036348 /main/src | |
parent | 4740ce100bad0328d90bdbae638a61d34816e292 (diff) |
[AspNetCore] Add support for launching any browser other than default
Diffstat (limited to 'main/src')
3 files changed, 31 insertions, 10 deletions
diff --git a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreExecutionCommand.cs b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreExecutionCommand.cs index 2c1d3c471b..f7077b2cde 100644 --- a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreExecutionCommand.cs +++ b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreExecutionCommand.cs @@ -24,17 +24,33 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using MonoDevelop.Core.Execution; using MonoDevelop.DotNetCore; namespace MonoDevelop.AspNetCore { - public class AspNetCoreExecutionCommand : DotNetCoreExecutionCommand + public class AspNetCoreExecutionCommand : ProcessExecutionCommand { public AspNetCoreExecutionCommand (string directory, string outputPath, string arguments) - : base (directory, outputPath, arguments) { + WorkingDirectory = directory; + OutputPath = outputPath; + DotNetArguments = arguments; + + Command = DotNetCoreRuntime.FileName; + Arguments = string.Format ("\"{0}\" {1}", outputPath, arguments); } + public string OutputPath { get; private set; } + public string DotNetArguments { get; private set; } + + public bool PauseConsoleOutput { get; set; } + public bool ExternalConsole { get; set; } + public bool LaunchBrowser { get; set; } + public string LaunchURL { get; set; } + public string ApplicationURL { get; set; } + public PipeTransportSettings PipeTransport { get; set; } + // Since we are now supporting more than one url, we added this property // so that it contains the raw value of AppUrl // which might provide more than one url i.e. https://localhost:5000;http://localhost:5001 diff --git a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreExecutionHandler.cs b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreExecutionHandler.cs index 1c93be2f29..ec1ae1642f 100644 --- a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreExecutionHandler.cs +++ b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreExecutionHandler.cs @@ -58,13 +58,14 @@ namespace MonoDevelop.AspNetCore console, envVariables); if (dotNetCoreCommand.LaunchBrowser) { - LaunchBrowser (dotNetCoreCommand.ApplicationURL, dotNetCoreCommand.LaunchURL, process.Task).Ignore (); + LaunchBrowser (dotNetCoreCommand.ApplicationURL, dotNetCoreCommand.LaunchURL, dotNetCoreCommand.Target, process.Task).Ignore (); } return process; } - public static async Task LaunchBrowser (string appUrl, string launchUrl, Task processTask) + public static async Task LaunchBrowser (string appUrl, string launchUrl, ExecutionTarget target, Task processTask) { + var aspNetCoreTarget = target as AspNetCoreExecutionTarget; launchUrl = launchUrl ?? ""; Uri launchUri; //Check if lanuchUrl is valid absolute url and use it if it is... @@ -102,7 +103,11 @@ namespace MonoDevelop.AspNetCore } // Process is still alive hence we succesfully connected inside loop to web server, launch browser - IdeServices.DesktopService.ShowUrl (launchUri.AbsoluteUri); + if (aspNetCoreTarget != null && !aspNetCoreTarget.DesktopApplication.IsDefault) { + aspNetCoreTarget.DesktopApplication.Launch (launchUri.AbsoluteUri); + } else { + IdeServices.DesktopService.ShowUrl (launchUri.AbsoluteUri); + } } } }
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreExecutionTarget.cs b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreExecutionTarget.cs index 2b787a3517..86cef8a38e 100644 --- a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreExecutionTarget.cs +++ b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreExecutionTarget.cs @@ -31,15 +31,15 @@ namespace MonoDevelop.AspNetCore { class AspNetCoreExecutionTarget : ExecutionTarget { - readonly DesktopApplication desktopApplication; - internal AspNetCoreExecutionTarget (DesktopApplication desktopApplication) { - this.desktopApplication = desktopApplication; + DesktopApplication = desktopApplication; } - public override string Name => desktopApplication.DisplayName; + public override string Name => DesktopApplication.DisplayName; + + public override string Id => DesktopApplication.Id; - public override string Id => desktopApplication.Id; + public DesktopApplication DesktopApplication { get; } } } |