Creating an extension
Create a project which works as a new extension.
To create an extension, follow these steps:
Open the solution NetAgent.sln.
Open the sample project, WpfExtensionSample.
This project is a new extension.
Locate the directory where you want to build the extensions (*.DLL files) of the WpfExtensionSample project
Create a class; for example, WpfExtensionPackage.cs, which extends the IExtensionPackage.
This is the entry point of the extension. The IExtensionPackage interface lets TestArchitect know that the generated DLL files of this project belong to the extension library.
IExtensionPackage is an interface of ExtensionLib. An extension must inherit the IExtensionPackage interface and implement all methods and properties of that interface.
public sealed class WpfExtensionPackage : IExtensionPackage { //Insert implementation code here }
Enter the code line below to import NetAgentExtension.
using Logigear.TestArchitect.NetAgent.Extensions;
Add a reference to NetExtensionLib.dll.
Copy the DLL file from <installation path>\LogiGear\TestArchitect\binclient\agents to your current working project directory.
Note:- On a 64 bit system: Select the NetExtensionLib_x64.dll file.
Right-click the WpfExtensionSample class.
Select Add Reference.
In the Browse tab, select NetExtensionLib_x64.dll (64 bit).
Click OK.
Implement the following interface members:
The Initialize method.
This method is invoked initially when the WPF agent is loaded.
Tip:Based on your specific requirements, you may need to implement more code in this method, such as registering handling, etc.Enter the code for the method below:
public void Initialize() { AbtTrace.Infor("Start load extension..."); }
The Name and Description methods.
Currently, these two methods are intended for backup purposes at a later time.
Enter the code below:
public string Name { get { return "Special Control"; } } public string Description { get { return "This extension supports a kind of special control"; } }
Generally, the source code of the WpfExtensionPackage.cs class should resemble the following:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Logigear.TestArchitect.NetAgent.Extensions;
using Logigear.TestArchitect.NetAgent.Diagnostics;
namespace Logigear.TestArchitect.NetAgent.SpecialControl
{
public sealed class WpfExtensionPackage : IExtensionPackage
{
static private WpfExtensionPackage instance = null;
public string Name
{
get { return "Special Control"; }
}
public string Description
{
get { return "This extension supports a kind of special control"; }
}
public void Initialize()
{
AbtTrace.Infor("Start load extension...");
}
}
}