Example #1
0
 public static void OpenLink(string link)
 {
     try
     {
         if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
         {
             Process.Start(link);
         }
         else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
         {
             Process.Start("xdg-open", link);
         }
         else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
         {
             Process.Start("open", link);
         }
     }
     catch (Exception ex) when(ExceptionFilters.OpenLinkExceptions(ex))
     {
         DisplayMessage.ErrorMessageBox(ex.GetType().Name, $"Unable to automatically open link. Please visit {link} manually using your browser.");
     }
 }