示例#1
0
 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);
     }
 }
示例#2
0
        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);
        }
示例#3
0
 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;
 }