' This file contains the Indigo sample AddIn. The class CIndigoConnector is instantiated ' by WebEdit using reflection; the instance can be obtained by a script using WebEdit's ' AddInManager (see the "TestIndigo.vb" module for details). ' ' To build the AddIn, navigate to the directory where this file lives, and ' ensure that your PATH includes the .NET framework. Invoke the VB.NET compiler ' like this (you need to adjust the /libpath): ' ' vbc.exe /t:Library /libpath:C:\Programme\WebEdit.NET\bin /r:Gregor.AppCore.dll,Gregor.Core.dll,Gregor.WebEdit.dll /rootnamespace:Indigo Indigo.vb ' ' Next, copy the DLL into the "bin" subdirectory in your WebEdit.NET ' installation. ' ' Then, choose "Tools/Settings" and select the "Extensibility" setting group. Click "Add" ' to select "Indigo.dll", and make sure the "Running" option is set. Close the dialog to ' start the AddIn. If the "AutoStart" option is set, the AddIn will start automatically ' at application startup. Imports System Imports Gregor.AppCore.Extensions ' defines the IAddInConnector interface Imports Gregor.Core ' Dev class, IOperationInfo interface Imports Gregor.WebEdit ' contains basic WebEdit functionality Public Class CIndigoConnector Implements IAddInConnector2 ' the connector must have a public parameterless constructor Public Sub New() MyBase.New() End Sub ' called at startup (check in message pane) Private Sub Initialize() Implements IAddInConnector2.Initialize Dev.Trace("Indigo.CIndigoConnector.Initialize()") End Sub ' called on termination (check in message pane) Private Sub Terminate() Implements IAddInConnector2.Terminate Dev.Trace("Indigo.CIndigoConnector.Terminate()") End Sub ' queries for additional features Private Function Supports(ByVal feature As Object) As Boolean Implements IAddInConnector2.Supports Dev.Trace("Indigo.CIndigoConnector.Supports()") Return feature Is AddInConnectorFeatures.AllowMacros _ OrElse feature Is AddInConnectorFeatures.AllowScripting _ OrElse feature Is AddInConnectorFeatures.GetDescription End Function ' performs an additional operation Private Function Perform(ByVal feature As Object, ByVal args As Object, ByVal info As IOperationInfo) As Object Implements IAddInConnector2.Perform Dev.Trace("Indigo.CIndigoConnector.Perform()") If feature Is AddInConnectorFeatures.GetDescription Then Return "WebEdit.NET 'Hello, World!' AddIn." End If ' ... Return Nothing End Function ' invoke this sub with a script (see the "TestIndigo.vb" module) Public Sub DoUsefulStuff() Try WebEditApp.ShowWelcomeScreen(True) Catch ex As Exception WebEditApp.ProcessException(ex) End Try End Sub ' invoke this function with WebEdit's code interpreter like this: ' code:Indigo.CIndigoConnector.GetIndigoInfo() _ Public Shared Function GetIndigoInfo() As String Return "Indigo is WebEdit.NET's ""Hello, World!"" sample AddIn." End Function ' sample AddIn-based macro with string parameters _ Public Shared Sub TestMacro(ByVal sArg As String) WebEditApp.ShowError("TestMacro", sArg) End Sub ' sample AddIn-based macro without parameters Public Shared Sub TestMacro2() WebEditApp.ShowError("TestMacro2") End Sub ' parameterless sub explicitly marked as non-macro _ Public Shared Sub NoMacro() WebEditApp.ShowError("NoMacro") End Sub End Class