Prev | Current Page 167 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

Show("An unhandled " & e.Exception.GetType().ToString() & _
" exception was caught and ignored.")
e.Handled = True
End Sub
you can connect to the Application.DispatcherUnhandled event by adding the Handles
keyword:
Private Sub Application_DispatcherUnhandledException(ByVal sender As Object, _
ByVal e As DispatcherUnhandledExceptionEventArgs) _
Handles Me.DispatcherUnhandledException
Or you can connect it by adding the DispatcherUnhandledException attribute to the
Application tag in the Application.xaml file:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
CHAPTER 3 n THE APPLICATION 64
Table 3-2. Continued
Name Description
StartupUri="Window1.xaml"
DispatcherUnhandledException="Application_DispatcherUnhandledException"
>

Application Tasks
Now that you understand how the Application object fits into a WPF application, you??™re ready
to take a look at how you can apply it to a few common scenarios. In the following sections,
you??™ll consider how you can process command-line arguments, support interaction between
windows, add document tracking, and create a single-instance application.
Handling Command-Line Arguments
To process command-line arguments, you react to the Application.


Pages:
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179