Loupe - Log - Monitor - Resolve
Loupe / Developer's Guide / For .NET Framework / For WinForms / User Opt In / Developer's Guide for WinForms - User Opt In - Displaying the Consent Dialog
In This Topic
    Developer's Guide for WinForms - User Opt In - Displaying the Consent Dialog
    In This Topic

    The Agent has a built-in dialog for users to indicate their decision, looking like this:

    Auto Send Consent Dialog

    The exact display is based on the configuration information you enter.

    When this feature is enabled, session auto send to server is not initialized when the agent starts.  This is done both to ensure the user's selection is respected and to ensure a rapid startup of the agent.  To have the user's preference take effect it's necessary to call Log.DisplayStartupConsentDialog in your application, typically after the main form has displayed.  This call is safe in all cases - if auto send isn't configured or the user has already made their election or the user has already been prompted enough times then it will still act correctly.  The dialog will only display once per process so it is safe to call from multiple places if there are multiple potential first forms.

    Integrating with WinForms
    Copy Code
    using System;
    using System.Windows.Forms;
    using Gibraltar.Agent;
    namespace OptInExample
    {
        public partial class MainForm : Form
        {
            public MainForm()
            {
                InitializeComponent();
            }
            protected override void OnShown(EventArgs e)
            {
                //now that the form has been displayed we're ready to show the consent dialog.
                Log.DisplayStartupConsentDialog();
            }
        }
    }
    
    If no call is made to DisplayStartupConsentDialog or DisplayConsentDialog, auto send will not start even if the user has previously opted in.

     

    See Also