Create a new Visual C# Console Application project.
Right click on References from the Solution Explorer and Add Reference. The Add Reference dialog box appears.
From the COM type libraries, select the HotDocs 11 Type Library, then click OK.
Add a using HotDocs; statement to the project.
Add a using System.Runtime.InteropServices; statement so you can release the COM object when finished with it.
Within the static void Main method add:
Application app = new Application();
Directly below the new Application object type app.OnAssemblyStartEvent += and then tab twice to generate the method stub for displaying a message when the event fires. This will add the following to the static void Main method.
app.OnAssemblyStartEvent += app_OnAssemblyStartEvent;
Comment out throw new NotImplementedException();
Directly below that, add the following code to the newly created event:
Console.WriteLine("OnAssemblyStart");
Add the following code to the static void Main method, below the new application object:
string tplPath, tplTitle, tplDesc; app.SelectTemplate("", true, out tplPath, out tplTitle, out tplDesc); if (tplPath != "") app.Assemblies.AddToQueue(tplPath); Console.ReadLine();
Add the following code to the end of the static void Main method, after the above code:
Marshal.ReleaseComObject(app);
The HotDocs SelectTemplate interface appears, allowing you to select a template from the library. When you select a template, it is added to the assembly queue. Then when the assembly starts, the app.OnAssemblyStart event fires and the console displays the message telling you that it fired.