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. 11
      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);
}

11
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,6 +654,13 @@ namespace ICSharpCode.ILSpy @@ -654,6 +654,13 @@ 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";
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
@ -663,8 +670,6 @@ namespace ICSharpCode.ILSpy @@ -663,8 +670,6 @@ namespace ICSharpCode.ILSpy
// just ignore all of them.
}
}
return decompilationTask;
}
#endregion
#region Open/Refresh

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