本文整理匯總了C#中System.Windows.Threading.DispatcherUnhandledExceptionEventArgs.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# DispatcherUnhandledExceptionEventArgs.ToString方法的具體用法?C# DispatcherUnhandledExceptionEventArgs.ToString怎麽用?C# DispatcherUnhandledExceptionEventArgs.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Threading.DispatcherUnhandledExceptionEventArgs
的用法示例。
在下文中一共展示了DispatcherUnhandledExceptionEventArgs.ToString方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: 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;
}
}
示例2: Application_DispatcherUnhandledException
// Global exception handling
// (event handler registered in App.xaml)
void Application_DispatcherUnhandledException( object sender, DispatcherUnhandledExceptionEventArgs e )
{
if ( e.Exception is NotLicensedException )
{
ShowErrorMessageBox( "You don't have a license for this feature" );
e.Handled = true;
}
else
{
//All other exceptions
string exceptionMessage = e.Exception != null ? e.Exception.Message : e.ToString();
ShowErrorMessageBox( "An error occurred: " + exceptionMessage );
e.Handled = false;
}
}
示例3: Application_DispatcherUnhandledException
// Global exception handling
// (event handler registered in App.xaml)
void Application_DispatcherUnhandledException( object sender, DispatcherUnhandledExceptionEventArgs e )
{
if ( e.Exception is NotLicensedException )
{
ShowErrorMessageBox( "You don't have a license for this feature" );
e.Handled = true;
// Redirect them to the activation dialog so they can install a valid license
var activationDialog = new ActivationDialog { Owner = MainWindow };
activationDialog.ShowDialog();
}
else
{
//All other exceptions
string exceptionMessage = e.Exception != null ? e.Exception.Message : e.ToString();
ShowErrorMessageBox( "An error occurred: " + exceptionMessage );
e.Handled = false;
}
}
示例4: App_DispatcherUnhandledException
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
bool logged = false;
e.Handled = true;
try
{
ILoggingService loggingService = ToolsUIApplication.Instance.RootServiceProvider.GetService(typeof(ILoggingService)) as ILoggingService;
if (loggingService != null)
{
loggingService.LogException(e.Exception);
logged = true;
}
}
finally
{
if (!logged)
{
Debug.WriteLine("Exception: " + e.ToString());
}
}
if (Debugger.IsAttached)
{
Debugger.Break();
}
}
示例5: Application_DispatcherUnhandledException
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
#if DEBUG
MessageBox.Show(Utilities.TextTidy(e.ToString()), "Unhandled Anomaly!", MessageBoxButton.OK, MessageBoxImage.Error);
#endif
}
示例6: App_DispatcherUnhandledException
void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
AsyncLogger.LogException(Tag, e.ToString());
// Prevent default unhandled exception processing
e.Handled = false;
}