2010-02-12 16 views

risposta

13

È possibile utilizzare DispatcherUnhandledException:

XAML (App.xaml):

<Application x:Class="App.App" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    StartupUri="wndMain.xaml" DispatcherUnhandledException="Application_DispatcherUnhandledException"> 

codice sottostante (App.xaml.cs/vb:.

private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) 
{ 
    // Handle error here 

    ... 

    // Prevent default unhandled exception processing by WPF 
    e.Handled = true; 
} 

documentarsi more here Sempre fare la corretta quantità di gestione degli errori in primo luogo però. Non lasciare che gli errori scivolino in questo metodo

Problemi correlati