本文整理汇总了C#中System.Windows.Threading.DispatcherUnhandledExceptionEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DispatcherUnhandledExceptionEventArgs类的具体用法?C# DispatcherUnhandledExceptionEventArgs怎么用?C# DispatcherUnhandledExceptionEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DispatcherUnhandledExceptionEventArgs类属于System.Windows.Threading命名空间,在下文中一共展示了DispatcherUnhandledExceptionEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:kiizoo,项目名称:Hearthstone-Deck-Tracker,代码行数:25,代码来源:App.xaml.cs
示例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;
}
开发者ID:kubaszostak,项目名称:KSz.Shared,代码行数:7,代码来源:WpfAppUIService.cs
示例3: OnDispatcherUnhandledException
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
LogService.RecordException(sender, e.Exception);
e.Handled = true;
Application.Current.Shutdown();
}
开发者ID:modulexcite,项目名称:WlanProfileViewer,代码行数:7,代码来源:App.xaml.cs
示例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
}
开发者ID:Provence,项目名称:MiniTwitter-Mod,代码行数:27,代码来源:App.xaml.cs
示例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;
}
开发者ID:hasantemel,项目名称:Coc-bot-Csharp,代码行数:7,代码来源:App.xaml.cs
示例6: My_DispatcherUnhandledException
private void My_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
if (e != null)
{
e.Handled = this.ShowException(e.Exception);
}
}
开发者ID:QuocHuy7a10,项目名称:Arianrhod,代码行数:7,代码来源:App.xaml.cs
示例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;
}
开发者ID:nathanashton,项目名称:Bookie,代码行数:7,代码来源:App.xaml.cs
示例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();
}
}
}
开发者ID:tenacious,项目名称:Auto.Squirrel,代码行数:28,代码来源:App.xaml.cs
示例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
}
开发者ID:kkcosmo,项目名称:Hearthstone-Deck-Tracker,代码行数:25,代码来源:App.xaml.cs
示例10: OnDispatcherUnhandledException
protected override void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
logger.Error(e.Exception);
e.Handled = true;
base.OnDispatcherUnhandledException(sender, e);
}
开发者ID:matteomigliore,项目名称:HSDK,代码行数:7,代码来源:TestExceptionHandler.cs
示例11: Application_DispatcherUnhandledException
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
if (ignore.IsChecked != null && ignore.IsChecked.Value)
{
e.Handled = true;
}
}
开发者ID:shivercube,项目名称:C-Sharp_Application_Classes,代码行数:7,代码来源:Window1.xaml.cs
示例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;
}
开发者ID:hemantksingh,项目名称:MusicManager,代码行数:27,代码来源:App.xaml.cs
示例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!");
}
开发者ID:paukr,项目名称:auremo,代码行数:7,代码来源:App.xaml.cs
示例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;
}
开发者ID:jackyying1130,项目名称:POC,代码行数:7,代码来源:App.xaml.cs
示例15: appDispatcherUnhandledException
private void appDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
new ExceptionLogger().LogExceptionToFile(e.Exception, AppMessenger.LogFile);
e.Handled = true;
addException(e.Exception);
}
开发者ID:yao-yi,项目名称:DNTProfiler,代码行数:7,代码来源:MainViewModel.cs
示例16: OnDispatcherUnhandledException
/// <summary>
/// A callback for non-caught exceptions.
///
/// Only reports to the crash logger in release.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
_logger.Error(e.Exception, "Uncatched error!");
#if !DEBUG
_raygun.Send(e.Exception, null, GetLogs());
#endif
}
开发者ID:freezy,项目名称:vpdb-agent,代码行数:14,代码来源:CrashManager.cs
示例17: Application_DispatcherUnhandledException
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
MessageBox.Show(e.Exception.Message + "\r\n" + e.Exception.StackTrace, "Application Error",
MessageBoxButton.OK, MessageBoxImage.Error);
e.Handled = false;
App.Current.Shutdown();
}
开发者ID:sohong,项目名称:greenfleet-viewer,代码行数:7,代码来源:App.xaml.cs
示例18: OnUnhandledException
private void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;
ErrorControl.Visibility = Visibility.Visible;
ErrorControl.Message = e.Exception.Message;
}
开发者ID:gotdibbs,项目名称:magician,代码行数:7,代码来源:MainWindow.xaml.cs
示例19: Application_DispatcherUnhandledException
// Global exception handling
// (event handler registered in App.xaml)
void Application_DispatcherUnhandledException( object sender, DispatcherUnhandledExceptionEventArgs e )
{
if ( e.Exception is DistributorIntegrityNotLicensedException )
{
ShowErrorMessageBox( "There's an integrity issue with your distributor. Please contact your Distributor Administrator." );
e.Handled = true;
}
else if ( e.Exception is DistributorNotLicensedException )
{
ShowErrorMessageBox( "There's a problem with your distributor. Please check your Licensing Configuration." );
e.Handled = true;
}
else if ( e.Exception is NotLicensedException )
{
ShowErrorMessageBox( "You don't have a license for this feature. Please check your Licensing Status." );
e.Handled = true;
}
else
{
//All other exceptions
string exceptionMessage = e.Exception != null ? e.Exception.ToString() : e.ToString();
ShowErrorMessageBox( "An error occurred: " + exceptionMessage );
e.Handled = false;
}
}
开发者ID:ps-PKrueger,项目名称:samples,代码行数:27,代码来源:App.xaml.cs
示例20: OnDispatcherUnhandledException
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs eventArgs)
{
Log.Fatal("Unhandled Exception.", eventArgs.Exception);
eventArgs.Handled = true;
MessageBox.Show("An unexpected error has occured. Please submit the log file.", "Oops!");
Shutdown();
}
开发者ID:flickr-downloadr,项目名称:flickr-downloadr,代码行数:7,代码来源:App.xaml.cs
注:本文中的System.Windows.Threading.DispatcherUnhandledExceptionEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论