本文整理汇总了C#中System.Windows.Threading.DispatcherUnhandledExceptionEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DispatcherUnhandledExceptionEventArgs类的具体用法?C# DispatcherUnhandledExceptionEventArgs怎么用?C# DispatcherUnhandledExceptionEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DispatcherUnhandledExceptionEventArgs类属于System.Windows.Threading命名空间,在下文中一共展示了DispatcherUnhandledExceptionEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: App_DispatcherUnhandledException
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
#if (!DEBUG)
var date = DateTime.Now;
var fileName = "Crash Reports\\"
+ string.Format("Crash report {0}{1}{2}-{3}{4}", date.Day, date.Month, date.Year, date.Hour, date.Minute);
if(!Directory.Exists("Crash Reports"))
Directory.CreateDirectory("Crash Reports");
using(var sr = new StreamWriter(fileName + ".txt", true))
{
sr.WriteLine("########## " + DateTime.Now + " ##########");
sr.WriteLine(e.Exception);
sr.WriteLine(Core.MainWindow.Options.OptionsTrackerLogging.TextBoxLog.Text);
}
MessageBox.Show(
"A crash report file was created at:\n\"" + Environment.CurrentDirectory + "\\" + fileName
+ ".txt\"\n\nPlease \na) create an issue on github (https://github.com/Epix37/Hearthstone-Deck-Tracker) \nor \nb) send me an email ([email protected]).\n\nPlease include the generated crash report(s) and a short explanation of what you were doing before the crash.",
"Oops! Something went wrong.", MessageBoxButton.OK, MessageBoxImage.Error);
e.Handled = true;
Shutdown();
#endif
}
示例2: OnUnhandledException
private static void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
//ReportUnhandledException(e.Exception);
//throw e.Exception;
AppServices.Dialog.ShowWarning(e.Exception.Message);
e.Handled = true;
}
示例3: OnDispatcherUnhandledException
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
LogService.RecordException(sender, e.Exception);
e.Handled = true;
Application.Current.Shutdown();
}
示例4: App_DispatcherUnhandledException
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
_isSaved = true;
try
{
MainTokenSource.Cancel();
}
catch
{
}
finally
{
MainTokenSource.Dispose();
}
#if !DEBUG
if (e.Exception == null)
{
Application.Current.Shutdown();
return;
}
//Log.Logger.Default.AddLogItem(new Log.LogItem(e.Exception));
MessageBox.Show("发生内部错误\n\n" + e.Exception.ToString(), App.NAME);
e.Handled = true;
Application.Current.Shutdown();
#endif
}
示例5: Application_DispatcherUnhandledException
void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
MessageBox.Show(e.Exception.Message, CoC.Bot.Properties.Resources.AppName, MessageBoxButton.OK, MessageBoxImage.Exclamation);
// Prevent default unhandled exception processing
e.Handled = true;
}
示例6: My_DispatcherUnhandledException
private void My_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
if (e != null)
{
e.Handled = this.ShowException(e.Exception);
}
}
示例7: OnDispatcherUnhandledException
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
Logger.Log.Error("Unhandled exception", e.Exception);
MessagingService.ShowErrorMessage(Common.Resources.Strings.Resources.UnhandledException,
e.Exception.ToString(), false);
e.Handled = true;
}
示例8: ShowUnhandeledException
private void ShowUnhandeledException(DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;
string errorMessage =
string.Format(
"An application error occurred.\nPlease check whether your data is correct and repeat the action. If this error occurs again there seems to be a more serious malfunction in the application, and you better close it.\n\nError:{0}\n\nDo you want to continue?\n(if you click Yes you will continue with your work, if you click No the application will close)",
e.Exception.Message + (e.Exception.InnerException != null
? "\n" +
e.Exception.InnerException.Message
: null));
Trace.TraceError(errorMessage);
Trace.TraceError("Stack Trace " + e.Exception.StackTrace);
Trace.TraceError("Source " + e.Exception.Source);
Trace.TraceError("Inner Exception3 " + e.Exception.InnerException);
//if (
// MessageBox.Show(errorMessage, "Application Error", MessageBoxButton.YesNoCancel, MessageBoxImage.Error, MessageBoxResult.No) ==
// MessageBoxResult.Yes)
{
{
Application.Current.Shutdown();
}
}
}
示例9: App_DispatcherUnhandledException
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
#if(DEBUG)
//Just so resharper codecleanup does not remove using system and system.io when in debug
if(File.Exists("HearthstoneDeckTracker.exe"))
Console.WriteLine("Ignore this");
#endif
#if (!DEBUG)
var date = DateTime.Now;
var fileName = "Crash Reports/" + string.Format("Crash report {0}{1}{2}-{3}{4}", date.Day, date.Month, date.Year, date.Hour, date.Minute);
if (!Directory.Exists("Crash Reports"))
Directory.CreateDirectory("Crash Reports");
using (var sr = new StreamWriter(fileName + ".txt", true))
{
sr.WriteLine("########## " + DateTime.Now + " ##########");
sr.WriteLine(e.Exception);
}
MessageBox.Show("Something went wrong.\nA crash report file was created at:\n\"" + Environment.CurrentDirectory + "\\" + fileName + "\"\nPlease create an issue in the github, message me on reddit (/u/tnx) or send this file to [email protected], with a short explanation of what you were doing before the crash.", "Oops!", MessageBoxButton.OK, MessageBoxImage.Error);
e.Handled = true;
Shutdown();
#endif
}
示例10: OnDispatcherUnhandledException
protected override void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
logger.Error(e.Exception);
e.Handled = true;
base.OnDispatcherUnhandledException(sender, e);
}
示例11: Application_DispatcherUnhandledException
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
if (ignore.IsChecked != null && ignore.IsChecked.Value)
{
e.Handled = true;
}
}
示例12: App_OnUnhandledException
private void App_OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
const string applicationTitle = "Music Manager";
const string logMessage = "An unhandled exception occurred";
string userMessage = string.Format("Oops!!! '{0}' ran into a problem. "
+ "The error details have been saved to the local log file.",
applicationTitle);
string userMsgIfErrorHandlingFails = string.Format("Oops!!! '{0}' ran into a problem. "
+ "Poosibly an error occured while bootstrapping the application.",
applicationTitle);
try
{
var errorHandler = _container.Resolve<IErrorHandler>();
errorHandler.HandleError(e.Exception, logMessage, userMessage);
}
catch (Exception exception)
{
var logger = _container.Resolve<ILogger>();
logger.LogError(logMessage, exception);
var promptService = new PromptService(applicationTitle);
promptService.ShowError(userMsgIfErrorHandlingFails);
}
e.Handled = true;
}
示例13: OnDispatcherUnhandledException
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
System.Windows.MessageBox.Show("Uncaught exception in Auremo.\n" +
"Please take a screenshot of this message and send it to the developer.\n\n" +
e.Exception.ToString(),
"Auremo has crashed!");
}
示例14: AppDispatcherUnhandledException
void AppDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
//do whatever you need to do with the exception
MessageBox.Show(e.Exception.Message);
e.Handled = true;
}
示例15: appDispatcherUnhandledException
private void appDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
new ExceptionLogger().LogExceptionToFile(e.Exception, AppMessenger.LogFile);
e.Handled = true;
addException(e.Exception);
}