private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { MessageBox.Show( e.Exception.Message + "\n\nПерезапустите приложение. Если ошибка повторится, обратитесь к администратору.", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); var userName = string.Empty; var machineName = string.Empty; var osVersion = string.Empty; var windowsIdentity = WindowsIdentity.GetCurrent(); if (windowsIdentity != null) { userName = windowsIdentity.Name.ToString(CultureInfo.InvariantCulture); machineName = Environment.MachineName.ToString(CultureInfo.InvariantCulture); osVersion = Environment.OSVersion.VersionString; } var message = e.Exception.Message; var source = e.Exception.Source; var targetSite = e.Exception.TargetSite.ToString(); var stackTrace = e.Exception.StackTrace; AdministrationClass.SendMessageToServer(userName, machineName, osVersion, message, source, targetSite, stackTrace); AdministrationClass.SendMessageToReport(userName, machineName, osVersion, message, source, targetSite, stackTrace); CloseAdministrationJournal(); }