Example #1
0
 /// <summary>
 /// Opens the URL.
 /// </summary>
 /// <param name="url">The URL.</param>
 private static void OpenUrl(IServerApplicationHost appHost, string url)
 {
     try
     {
         appHost.LaunchUrl(url);
     }
     catch (NotSupportedException)
     {
     }
     catch (Exception)
     {
     }
 }
Example #2
0
 /// <summary>
 /// Opens the specified URL in an external browser window. Any exceptions will be logged, but ignored.
 /// </summary>
 /// <param name="appHost">The application host.</param>
 /// <param name="relativeUrl">The URL to open, relative to the server base URL.</param>
 private static void TryOpenUrl(IServerApplicationHost appHost, string relativeUrl)
 {
     try
     {
         string baseUrl = appHost.GetLocalApiUrl("localhost");
         appHost.LaunchUrl(baseUrl + relativeUrl);
     }
     catch (Exception ex)
     {
         var logger = appHost.Resolve <ILogger>();
         logger?.LogError(ex, "Failed to open browser window with URL {URL}", relativeUrl);
     }
 }
Example #3
0
 /// <summary>
 /// Opens the URL.
 /// </summary>
 /// <param name="url">The URL.</param>
 private static void OpenUrl(IServerApplicationHost appHost, string url)
 {
     try
     {
         appHost.LaunchUrl(url);
     }
     catch (NotImplementedException)
     {
     }
     catch (Exception ex)
     {
         Console.WriteLine("Error launching url: " + url);
         Console.WriteLine(ex.Message);
     }
 }
Example #4
0
 /// <summary>
 /// Opens the URL.
 /// </summary>
 /// <param name="url">The URL.</param>
 private static void OpenUrl(IServerApplicationHost appHost, string url)
 {
     try
     {
         appHost.LaunchUrl(url);
     }
     catch (NotImplementedException)
     {
         
     }
     catch (Exception ex)
     {
         Console.WriteLine("Error launching url: " + url);
         Console.WriteLine(ex.Message);
     }
 }