Creating System Extensions
It is possible to create an extension that cannot be disabled by the user without physically deleting the DLL file. This approach was taken due to the fact that users typically do not have permissions to delete files under Program Files. To create a system extension, when calling the constructor of the BaseExtension class, use the overload which accepts an isSystemExtension parameter. Simply pass in a value of true to make a system extension.
The following code is the same as the previous example, except true is being passed in for the final parameter (isSystemExtension), which makes it a system extension.
"Generates a notification that dumps all field values into a notification",
The Window Factory
The WindowFactory is a static class that can be used to create windows inside of irAuthor to capture information. Windows are made by creating a WPF User Control. Xaml can be used to built out entire forms with all of the standard WPF controls. The WindowFactory can then be leveraged to load the forms from inside the extension.
Here is an example of a custom window that was created in an extension:
Assuming a WPF User Control is created and named TestDataControl, the following code will create an instance of the window and launch it inside of irAuthor.
// Create an instance of the user control
var control = new TestDataControl(settings);
// Use the window factory to create the window passing the description, control and required buttons
var window = WindowFactory.CreateWindow("Test settings", control, "OK", "Cancel");
// Subscribe to the click event to run the desired code
window.ButtonClicked += myClickEvent;
Debugging with Developer extension
InRule ships with a Developer extension that is very useful when creating an irAuthor Extension. The extension is not enabled by default, but can be enabled by going to File --> Extensions. Check the check box next to "Developer" to enable the extension.
Once enabled, a new tab in the Ribbon labeled "Developer" will appear, as shown here:
Below is a list of utilities available along with a description of each.
This is by far the most useful utility available. It allows an extension developer to go into irAuthor and attach to the instance of their Visual Studio project that contains the extension code. Once attached, all of the developers code is available for debugging. This means you can set a break point in the code, click the button created by the extension and step through the code. This greatly increases the ability to create and debug irAuthor extensions.
The process is as follows:
- Click the Attach Debugger button – This will launch the standard Visual Studio attachment window
- Select the instance of Visual Studio that has the desired extension project open
- Set a break point in the solution
- Go back to irAuthor and perform the action (button click, select item, etc.) that will trigger the extension code
- The break point should be hit and you can step through the code
The Property Grid displays all public and private properties for the currently selected object. This is useful for scenarios where a developer wants to create their own View and needs to see which properties are available for binding to the View Model.
The event watcher will display relevant events that are firing in irAuthor. This assists a developer when they are trying to figure out which events to attach to for their extensions.
Using post build events to simplify testing
To simplify testing when creating an extension, make a post-build event that will copy the compiled DLL to the Extensions folder where irAuthor is running. irAuthor will need to be closed each time so the file copies successfully.
copy $(TargetPath) <InRule installation directory>\irAuthor\Extensions\