Loupe - Log - Monitor - Resolve
Loupe / Getting Started / .NET Framework / Using Loupe with WPF / Developer's Guide for WPF - Ensuring Your Application Exits
In This Topic
    Developer's Guide for WPF - Ensuring Your Application Exits
    In This Topic

    Because the Loupe Agent buffers data and performs operations in the background for best application performance it has to be notified when the application wants to exit so it can enter a shutdown mode.  The best way to do this in WPF is to:

    1. Add an event handler to the application Exit event
    2. Call Log.EndSession during this event.
    Application Exit Event Handler
    Copy Code
    using Gibraltar.Agent;
    private void Application_Exit(object sender, ExitEventArgs e)
    {
        //This call ensures that the Agent will prepare to exit and close out any open windows.
        Log.EndSession("Ending WPF Sample Normally");
    } 
    
    This is a small part of a larger sample, see Using Loupe with WPF - Integration Code for all of the integration points.
    See Also