Loupe - Log - Monitor - Resolve
Loupe / Getting Started / .NET Framework / Using Loupe with WPF / Developer's Guide for WPF - Live Log Viewer Control
In This Topic
    Developer's Guide for WPF - Live Log Viewer Control
    In This Topic

    The Loupe Agent includes a live viewer control that you can easily integrate with your WinForms or WPF application.

    Live Log Viewer

    Live Log Viewer

    The Live Log Viewer control can be placed anywhere in your application, and you can have multiple viewers at the same time.  The Live Log Viewer control is designed to be easy to integrate.  Because it is a WinForms control, it requires a WindowsFormsHost element to be hosted directly on a WPF Window.  Here is an example of a Window hosting the control:

    Alternate Live Viewer Xaml Example
    Copy Code
    <Window x:Class="AgentTest.Wpf.AlternateLiveViewer"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Live Viewer Control Example" Height="300" Width="726" xmlns:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration" xmlns:gl="clr-namespace:Gibraltar.Agent.Windows;assembly=Gibraltar.Agent">
        <Grid>
            <TabControl Name="mainTabControl">
                <TabItem Header="Live Log Viewer" Name="logViewerTab">
                    <Grid>
                        <my:WindowsFormsHost Name="logViewerInFormsHost">
                            <gl:LiveLogViewer x:Name="liveLogViewer" Dock="Fill" />
                        </my:WindowsFormsHost>
                    </Grid>
                </TabItem>
                <TabItem Header="Other Content" Name="contentTab">
                    <Grid />
                </TabItem>
            </TabControl>
        </Grid>
    </Window>
    

    For complete information on how to program with the Live Log Viewer, see LiveLogViewer Class.

    Before integrating the Live Log Viewer Control into your application, consider if the Loupe Live Viewer may be a better option.  Although the hot key interaction does not work with WPF, you can invoke it directly by calling Log.ShowLiveViewer.  Because it runs on its own thread (instead of your user interface thread) it remains responsive to messages even when the user interface isn't.

    To ensure the agent doesn't cause a problem at runtime all GUI capabilities are disabled if the application type isn't determined to be Windows. If you have manually set the application type to another type or it wasn't detected correctly then the Live Viewer will not work.

    See Also