Core - Added utility for opening URLs in the default browser

This commit is contained in:
Robert committed 2020-10-14 20:50:16 +02:00
1 parent 016d39d034
commit 8be1945145
7 files changed
+28 -22

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ namespace Artemis.Core
/// <summary>
/// The full path to the Artemis executable
/// </summary>
public static readonly string ExecutablePath = ApplicationUtilities.GetCurrentLocation();
public static readonly string ExecutablePath = Utilities.GetCurrentLocation();
/// <summary>
/// The full path to the Artemis data folder
@@ -5,9 +5,9 @@ using Stylet;
namespace Artemis.Core
{
/// <summary>
/// Provides utilities to manage the application
/// Provides a few general utilities for ease of use
/// </summary>
public static class ApplicationUtilities
public static class Utilities
{
/// <summary>
/// Attempts to gracefully shut down the application with a delayed kill to ensure the application shut down
@@ -39,6 +39,21 @@ namespace Artemis.Core
Execute.OnUIThread(() => Application.Current.Shutdown());
}
/// <summary>
/// Opens the provided URL in the default web browser
/// </summary>
/// <param name="url">The URL to open</param>
/// <returns>The process created to open the URL</returns>
public static Process OpenUrl(string url)
{
ProcessStartInfo processInfo = new ProcessStartInfo
{
FileName = url,
UseShellExecute = true
};
return Process.Start(processInfo);
}
/// <summary>
/// Gets the current application location
/// </summary>