Exemple #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)
     {
     }
 }
 /// <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);
     }
 }
Exemple #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);
     }
 }
Exemple #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);
     }
 }