Prev | Current Page 165 | Next

Matthew MacDonald

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

Run() method is called and just
before the main window is shown (if you passed the main
window to the Run() method). You can use this event to check for
any command-line arguments, which are provided as an array
through the StartupEventArgs.Args property. You can also use
this event to create and show the main window (instead of using
the StartupUri property in the Application.xaml file).
Exit Occurs when the application is being shut down for any reason,
just before the Run() method returns. You can??™t cancel the
shutdown at this point, although the code in your Main() method
could relaunch the application. You can use the Exit event to set
the integer exit code that??™s returned from the Run() method.
SessionEnding Occurs when the Windows session is ending??”for example, when
the user is logging off or shutting down the computer. (You can
find out which one it is by examining the SessionEndingCancel-
EventArgs.ReasonSessionEnding property.) You can also cancel
the shutdown by setting SessionEndingCancelEventArgs.Cancel
to True. If you don??™t, WPF will call the Application.Shutdown()
method when your event handler ends.
CHAPTER 3 n THE APPLICATION 63
Continued
Activated Occurs when one of the windows in the application gets
activated. This occurs when you switch from another Windows
program to this application.


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