void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { ExceptionWindow exWin = new ExceptionWindow(); exWin.SetException(e.ExceptionObject as Exception); exWin.ShowDialog(); }
private void ShowMessage(Exception exception) { if (this.prevException?.TargetSite == exception?.TargetSite) { return; } this.prevException = exception; ThreadPool.QueueUserWorkItem(item => { UIDispatcher.Invoke(() => { var exceptionWindow = new ExceptionWindow { AllowsTransparency = true, WindowStyle = WindowStyle.None, Exception = exception, WindowStartupLocation = WindowStartupLocation.CenterOwner }; if (Application.Current.MainWindow != exceptionWindow) { exceptionWindow.Owner = Application.Current.MainWindow; } exceptionWindow.ShowDialog(); }); this.prevException = null; }); }
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { ExceptionWindow exWin = new ExceptionWindow(e.Exception); exWin.ShowDialog(); e.Handled = true; }
/// <summary> /// Show the Exception Window /// </summary> /// <param name="shortError"> /// The short error. /// </param> /// <param name="longError"> /// The long error. /// </param> public static void ShowExceptiowWindow(string shortError, string longError) { ExceptionWindow window = new ExceptionWindow(); window.Setup(shortError, longError); window.ShowDialog(); }
public void SaveChanges() // Edit or Add Order data and save it to DB { string emailPattern = @"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"; if (!String.IsNullOrEmpty(InputName) || !String.IsNullOrEmpty(InputSurname) || !String.IsNullOrEmpty(InputEmail) || !String.IsNullOrEmpty(InputPhone)) { if (InputPhone.Length < 11 || InputPhone.Any(Char.IsLetter) || !InputPhone.StartsWith("7")) { string message = "Phone must have 11 digits and start with 7."; var exceptionWindow = new ExceptionWindow(message); exceptionWindow.ShowDialog(); } else if (Regex.IsMatch(InputEmail, emailPattern) == false) { string message = "Incorrect email format."; var exceptionWindow = new ExceptionWindow(message); exceptionWindow.ShowDialog(); } else if (SelectedGender == Genders[0] || SelectedGender == null) { string message = "You need to select gender."; var exceptionWindow = new ExceptionWindow(message); exceptionWindow.ShowDialog(); } else { if (_currentClient == null) { _currentClient = new Client() { Name = InputName, Surname = InputSurname, Phone = InputPhone, Email = InputEmail, Gender = SelectedGender, LastVisit = DateTime.Parse("01/01/01"), }; context.Client.Add(_currentClient); } else { _currentClient.Name = InputName; _currentClient.Surname = InputSurname; _currentClient.Phone = InputPhone; _currentClient.Email = InputEmail; _currentClient.Gender = SelectedGender; } context.SaveChanges(); } } else { string message = "You need to complete all the fields."; var exceptionWindow = new ExceptionWindow(message); exceptionWindow.ShowDialog(); } }
/// <summary> /// Throw up an error message for any unhandled exceptions. /// </summary> /// <param name="sender">The sender</param> /// <param name="e">Unhandled Exception EventArgs </param> private static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e) { try { ExceptionWindow window = new ExceptionWindow(); if (e.ExceptionObject.GetType() == typeof(GeneralApplicationException)) { GeneralApplicationException applicationException = e.ExceptionObject as GeneralApplicationException; if (applicationException != null) { window.Setup( applicationException.Error + Environment.NewLine + applicationException.Solution, e.ExceptionObject + "\n\n ---- \n\n" + applicationException.ActualException); } } else { window.Setup("An Unknown Error has occured.", e.ExceptionObject.ToString()); } window.ShowDialog(); } catch (Exception) { MessageBox.Show( "An Unknown Error has occured. \n\n Exception:" + e.ExceptionObject, "Unhandled Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private static void ShowUnhandledException(object exceptionObject) { Logger.logError("Exception: " + exceptionObject.ToString()); string errorText = ""; string stackTrace = ""; if (exceptionObject is Exception) { errorText = (exceptionObject as Exception).Message; stackTrace = "\r\n" + (exceptionObject as Exception).GetType().Name + "\r\n" + (exceptionObject as Exception).StackTrace; } else { stackTrace = exceptionObject.ToString(); string[] lines = stackTrace.Split(new char[] { '\n' }); if (lines != null && lines.Length > 0) { errorText = lines[0]; } } ExceptionWindow win = new ExceptionWindow(errorText, stackTrace); win.ShowDialog(); }
internal void ShowException(string msg) { this.PlayStream(Resources.Error); ExceptionWindow ewin = new ExceptionWindow(msg); ewin.ShowDialog(); }
private void Button_StepClick(object sender, RoutedEventArgs e) { enableCheckboxes(false, false, false); enableButtons(false, false, false); lockRecordCreationTools(); Label_StatusBarLabel.Content = "Busy..."; try { Sorter.Merger.Step(); } catch (Exception ex) { var ExWin = new ExceptionWindow(ex.GetType().ToString(), ex.Message, ex.StackTrace); ExWin.ShowDialog(); } string infoText = "Step. "; if (Sorter.Merger.FileIsSorted) { infoText = "Done! "; lockRecordCreationTools(false); Sorter.RestoreOriginalFileName(); } Label_StatusBarLabel.Content = buildAccessInfoString(infoText); tryToDisplayTextIn(TextBlock_SortedFile); enableButtons(true, true, true); }
public static void HandleException(Window owner, Exception ex) { ExceptionWindow win = new ExceptionWindow(); win.Exception = ex; win.Owner = owner; win.ShowDialog(); }
/// <summary> /// This method opens a new ExceptionWindow with the /// passed exception object as datacontext. /// </summary> public override void OnUnhandledException(Exception e, bool terminate) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { var exceptionWindow = new ExceptionWindow(); exceptionWindow.DataContext = new ExceptionWindowViewModel(e, terminate); exceptionWindow.ShowDialog(); })); }
public static void DefaultErrHandling(Exception exc) { #if DEBUG throw exc; #else ExceptionWindow wnd = new ExceptionWindow(); wnd.excText.Text = exc.ToString(); wnd.ShowDialog(); #endif }
public void Launch() { var exception = GetException(); var model = new ExceptionWindowModel { ExceptionText = exception.ExceptionHierarchyToString(), }; var window = new ExceptionWindow(model); window.ShowDialog(); }
public bool ShowException(Exception exception) { LastException = exception; WriteLog(); ExceptionWindow = new ExceptionWindow(); ExceptionWindow.SetException(LastException); var showDialog = ExceptionWindow.ShowDialog(); return(showDialog != null && (bool)showDialog); }
/// <summary> /// Shows exception and exit application /// </summary> /// <param name="exception">The exception.</param> public static void ShowAndExitApplication(this Exception exception) { ExceptionWindow showExceptionWindow = new ExceptionWindow { DataContext = new ExceptionViewModel(Resources.UnhandledException, Resources.UnhandledExceptionOccurredApplicationWillBeClosed, exception) }; showExceptionWindow.ShowDialog(); Environment.Exit(-1); }
/// <summary> /// This method opens a new ExceptionWindow with the /// passed exception object as datacontext. /// </summary> public override void OnUnhandledException(Exception ex, bool terminate) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { var exceptionWindow = new ExceptionWindow(); var logService = ((App)App.Current).GetLogService(); var vm = new ExceptionWindowViewModel(logService, ex, terminate); vm.OnRequestClose += (s, e) => exceptionWindow.Close(); exceptionWindow.DataContext = vm; exceptionWindow.ShowDialog(App.Current.MainWindow); })); }
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { if (!ShowingException) //In case an exception causes a cascade of accompanying exceptions in other threads (shouldn't happen), only allow the first one to show { ShowingException = true; ExceptionWindow exceptionWindow = new ExceptionWindow(e); exceptionWindow.ShowDialog(); wnd.Close(); Current.Shutdown(); } }
public void Launch() { var exception = GetException(); var model = new ExceptionWindowModel { ExceptionText = exception.ExceptionHierarchyToString(), }; var window = new ExceptionWindow(model); window.ShowDialog(); }
private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { var errorWindow = new ExceptionWindow { Owner = Current.MainWindow, Message = e.Exception.Message, StackTrace = e.Exception.StackTrace }; errorWindow.ShowDialog(); }
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { #if !DEBUG SentrySdk.CaptureException(e.Exception); #endif var exceptionWindow = new ExceptionWindow(e.Exception, true); var val = exceptionWindow.ShowDialog(); e.Handled = val != true; if (val == true) { Environment.Exit(1); } }
private void SendMail(Exception e) { var window = new ExceptionWindow(e) { Title = "Crema Server App", MailAddress = "*****@*****.**", UserName = "******", Password = "******", }; window.ShowDialog(); Environment.Exit(-1); }
public void HandleException(Exception exception) { var model = new ExceptionWindowModel { ExceptionText = exception.ExceptionHierarchyToString(), }; var window = new ExceptionWindow(model); new WindowInteropHelper(window) { Owner = GetActiveWindow() }; window.ShowDialog(); }
public void Launch() { var exception = GetException(); var model = new ExceptionWindowModel { ExceptionText = exception.ExceptionHierarchyToString(), }; var runner = new CrossThreadRunner(); runner.RunInSta(() => { var window = new ExceptionWindow(model); window.ShowDialog(); }); }
public void HandleException(Exception exception) { var model = new ExceptionWindowModel { ExceptionText = exception.ExceptionHierarchyToString(), }; var window = new ExceptionWindow(model); new WindowInteropHelper(window) { Owner = GetActiveWindow() }; window.ShowDialog(); }
public static void HandleException(Exception e) { if (e is SQLiteException) { if (e.Message.Contains("constraint")) { return; } } ExceptionWindow window = new ExceptionWindow(e); window.ShowDialog(); }
public void SaveChanges() { if (!String.IsNullOrEmpty(InputName) || !String.IsNullOrEmpty(InputSurname) || !String.IsNullOrEmpty(SelectedDate.ToString())) { if (SelectedGender == Genders[0] || SelectedGender == null) { string message = "You need to select gender."; var exceptionWindow = new ExceptionWindow(message); exceptionWindow.ShowDialog(); } else if (SelectedRole == Roles[0] || SelectedRole == null) { string message = "You need to select role."; var exceptionWindow = new ExceptionWindow(message); exceptionWindow.ShowDialog(); } else { if (_currentEmployee == null) { _currentEmployee = new Employee() { Name = InputName, Surname = InputSurname, Gender = SelectedGender, Role = SelectedRole, DateOfEmployment = SelectedDate }; } else { _currentEmployee.Name = InputName; _currentEmployee.Surname = InputSurname; _currentEmployee.Gender = SelectedGender; _currentEmployee.Role = SelectedRole; _currentEmployee.DateOfEmployment = SelectedDate; } context.SaveChanges(); } } else { string message = "You need to complete all the fields."; var exceptionWindow = new ExceptionWindow(message); exceptionWindow.ShowDialog(); } }
public void Launch() { var exception = GetException(); var model = new ExceptionWindowModel { ExceptionText = exception.ExceptionHierarchyToString(), }; var runner = new CrossThreadRunner(); runner.RunInSta(() => { var window = new ExceptionWindow(model); window.ShowDialog(); }); }
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { var logger = LogManager.GetCurrentClassLogger(); logger.Error(e.Exception, "DispatcherUnhandledException"); var exceptionWindow = new ExceptionWindow(e.Exception, true); var val = exceptionWindow.ShowDialog(); e.Handled = val != true; if (val == true) { Environment.Exit(1); } }
public bool Open() { if (SelectedEmployee != null && SelectedEmployee != Employees[0]) { StartWindow startWindow = new StartWindow(SelectedEmployee); startWindow.Show(); return(true); } else { string message = "You need to select employee account."; var exceptionWindow = new ExceptionWindow(message); exceptionWindow.ShowDialog(); return(false); } }
public void ShowException(Exception Exception, string Message, bool Blocking = false) { Application.Current.Dispatcher.Invoke(() => { var win = new ExceptionWindow(Exception, Message); if (Blocking) { win.ShowDialog(); } else { win.ShowAndFocus(); } }); }
//Handle Common Messages to all Windows Here void HandleMessages(Message message) { switch (message.MessageType) { case MessageType.OpenExceptionWindow: Exception ex = message.MessageObject as Exception; ExceptionWindow window = new ExceptionWindow(); window.Exception = ex; window.ShowDialog(); break; //other common cases should be handled here default: HandleWindowLevelMessage(message); break; } }
private void createNewExceptionWindow(Exception ex, string details = null) { string exceptionDetails = details; if (string.IsNullOrEmpty(details)) { exceptionDetails = ex.StackTrace; } else { exceptionDetails = details + "\n" + ex.StackTrace; } ExceptionWindow ExWin = new ExceptionWindow(ex.GetType().ToString(), ex.Message, exceptionDetails); ExWin.ShowDialog(); allowDisplayingFiles = false; }
/// <summary> /// Throw up an error message for any unhandled exceptions. /// </summary> /// <param name="sender">The sender</param> /// <param name="e">Unhandled Exception EventArgs </param> private static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e) { try { ExceptionWindow window = new ExceptionWindow(); window.Setup("An Unknown Error has occured.", e.ExceptionObject.ToString()); window.ShowDialog(); } catch (Exception) { MessageBox.Show( "An Unknown Error has occured. \n\n Exception:" + e.ExceptionObject, "Unhandled Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { ExceptionWindow exWin = new ExceptionWindow(); exWin.SetException(e.ExceptionObject as Exception); exWin.ShowDialog(); }