10
Bir WPF uygulamasında işlenmeyen bir özel durumu ele almanın en iyi yolu nedir?İşlenmeyen özel durum
Bir WPF uygulamasında işlenmeyen bir özel durumu ele almanın en iyi yolu nedir?İşlenmeyen özel durum
kullanabilirsiniz DispatcherUnhandledException
:
XAML (App.xaml): Kod Arkası (App.xaml.cs/vb
<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">
.
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
// Handle error here
...
// Prevent default unhandled exception processing by WPF
e.Handled = true;
}
more here kadar okundu Daima ilk etapta hata işlemenin doğru miktarda yapılmasını sağlayın.Sadece hataların bu yönteme girmesine izin vermeyin