Implement a Simple Test AddIn
Add a reference to System.Windows.Forms (in the Solution Explorer right-click References / Add Reference; in the .NET tab choose System.Windows.Forms and click OK) and make the following changes to your code:
C#
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Therefore.API;
namespace MyAddInLibrary
{
[Guid("819D4F41-8AAE-43BF-BFA4-2EB848FDF703"), ComVisible(true), ClassInterface(ClassInterfaceType.None)]
public class MyAddInClass : ITheAddIn
{
#region ITheAddIn Members
public void GetHandledEvents(TheClientType nClient, TheEventSet pEventSet)
{
MessageBox.Show("MyAddInClass successfully registered.");
}
public int HandleEvent(TheEvent pEvent)
{
throw new NotImplementedException();
}
#endregion
}
}
pEventSet.AddAll() will tell the Thereforeā¢ AddIn system that we want to receive all occurring events.
In HandleEvent we display a message box with a string representation of the incoming event. We return the default return code (0), thereby telling the AddIn system to continue as usual. Please check the various events for the event-specific meaning of different return codes.
|