private void LicensesCommandExecuted(object obj) { try { string assemblyLocation = Assembly.GetAssembly(typeof(AboutDialog)).Location; string dirPath = Path.GetDirectoryName(assemblyLocation); if (dirPath == null) { return; } string filePath = Path.Combine(dirPath, "LICENSES.txt"); Process.Start(filePath); } catch (Exception exception) { ExceptionDialog.Show(exception, this); } }
public static bool Show(Exception exception, object owner = null) { var depObj = owner as DependencyObject; var result = false; SendOrPostCallback action = obj => { var w = new ExceptionDialog((Exception)obj); try { w.Owner = depObj == null ? Application.Current.MainWindow : GetWindow(depObj); } catch (InvalidOperationException) { } result = w.ShowDialog() == true; }; var context = new DispatcherSynchronizationContext(Application.Current.Dispatcher); context.Send(action, exception); return(result); }
public static bool Show(Exception exception, object owner = null) { var depObj = owner as DependencyObject; var result = false; SendOrPostCallback action = obj => { var w = new ExceptionDialog((Exception)obj); try { w.Owner = depObj == null ? Application.Current.MainWindow : GetWindow(depObj); } catch (InvalidOperationException) { } result = w.ShowDialog() == true; }; var context = new DispatcherSynchronizationContext(Application.Current.Dispatcher); context.Send(action, exception); return result; }