Browse Source

Move Process.Start-calls to a central helper method. This ensures we do not crash if there's an OS configuration error, missing browser, whatever.

pull/863/head
Siegfried Pammer 8 years ago
parent
commit
de98536f73
  1. 2
      ILSpy/AboutPage.cs
  2. 21
      ILSpy/MainWindow.xaml.cs
  3. 2
      ILSpy/TreeNodes/SearchMsdnContextMenuEntry.cs

2
ILSpy/AboutPage.cs

@ -167,7 +167,7 @@ namespace ICSharpCode.ILSpy @@ -167,7 +167,7 @@ namespace ICSharpCode.ILSpy
button.Content = "Download";
button.Cursor = Cursors.Arrow;
button.Click += delegate {
Process.Start(availableVersion.DownloadUrl);
MainWindow.OpenLink(availableVersion.DownloadUrl);
};
stackPanel.Children.Add(button);
}

21
ILSpy/MainWindow.xaml.cs

@ -418,7 +418,7 @@ namespace ICSharpCode.ILSpy @@ -418,7 +418,7 @@ namespace ICSharpCode.ILSpy
void downloadOrCheckUpdateButtonClick(object sender, RoutedEventArgs e)
{
if (updateAvailableDownloadUrl != null) {
Process.Start(updateAvailableDownloadUrl);
MainWindow.OpenLink(updateAvailableDownloadUrl);
} else {
updatePanel.Visibility = Visibility.Collapsed;
AboutPage.CheckForUpdatesAsync(spySettings ?? ILSpySettings.Load())
@ -654,16 +654,21 @@ namespace ICSharpCode.ILSpy @@ -654,16 +654,21 @@ namespace ICSharpCode.ILSpy
SelectNode(treeNode);
} else if (reference is Mono.Cecil.Cil.OpCode) {
string link = "http://msdn.microsoft.com/library/system.reflection.emit.opcodes." + ((Mono.Cecil.Cil.OpCode)reference).Code.ToString().ToLowerInvariant() + ".aspx";
try {
Process.Start(link);
OpenLink(link);
}
return decompilationTask;
}
public static void OpenLink(string link)
{
try {
Process.Start(link);
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
} catch (Exception) {
} catch (Exception) {
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
// Process.Start can throw several errors (not all of them documented),
// just ignore all of them.
}
// Process.Start can throw several errors (not all of them documented),
// just ignore all of them.
}
return decompilationTask;
}
#endregion

2
ILSpy/TreeNodes/SearchMsdnContextMenuEntry.cs

@ -106,7 +106,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -106,7 +106,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
address = address.ToLower();
if (!string.IsNullOrEmpty(address))
Process.Start(address);
MainWindow.OpenLink(address);
}
}
}
Loading…
Cancel
Save