EventLogger - harborsiem/WinForms-Ribbon GitHub Wiki

EventLogger

EventLogger handles COM interface IUIEventLogger.

!Note:
Only available since Windows 8.

Since Windows 8 the Windows Ribbon framework provides developers an event logging mechanism.

Public constructors, methods, properties and events:

Constructors:

EventLogger is initialized by RibbonStrip and is available in RibbonStrip property EventLogger.

Methods:

Name Description
Attach() Attach to an IUIEventLogger and IUIEventingManager objects events .
Detach() Detach the log events.

Properties:

Events:

Name Description
LogEvent User can handle logging informations. EventArgs are EventLoggerEventArgs.

In your EventHandler for the LogEvent you get the EventLoggerEventArgs class.


Example:

Ribbon.EventLogger.LogEvent += DiagnosticLog;
Ribbon.EventLogger.Attach();
...
...
Ribbon.EventLogger.Detach();
Ribbon.EventLogger.LogEvent -= DiagnosticLog;

private void DiagnosticLog(object sender, EventLoggerEventArgs e)
{
switch (e.EventType){
    case EventType.CommandExecuted:
        uint id = e.CommandId;
        ...
        break;
    case EventType.TabActivated:
        ...
        break;
}
}
⚠️ **GitHub.com Fallback** ⚠️