Code Integration

This type of integration allows for more complex integrations when special logic needs to be executed. To create such a plugin, please follow the steps below:

1. In Visual Studio, create a new Class Library project (or you could add the code to an existing Class Library project)

2. Add avt.NavXp.Core.dll as a reference to the project (you can get this file for the website bin folder from the NavXp zip package).

3. Add a new class to your project and use the code below as a starting point

using System; using System.Collections.Generic; using System.Text; using avt.NavXp.Core.Plugins; namespace avt.NavXp.TestPlugin { public class MyPlugin : IPlugin { #region IPlugin Members public string GetPluginName() { return "Test Plugin"; } public IDictionary<string, string> GetDataSources() { return new Dictionary<string, string>() { { "dsid1", "Test Data Source" }, { "dsid2", "Another Test Source" } }; } public IList<IDictionary<string, object>> GetItems(string dataSourceId) { IList<IDictionary<string, object>> items = new List<IDictionary<string, object>>(); items.Add(new Dictionary<string, object>() { { "id", "item1" }, { "caption", "This is test item" }, { "url", "http://yoursite.here" } }); items.Add(new Dictionary<string, object>() { { "id", "item2" }, { "caption", "Another one" }, { "url", "http://yoursite.here" } }); return items; } #endregion } } 

4. Compile the project and copy the resulting DLL assembly to your website bin folder where there also should be avt.NavXp.dll and avt.NavXp.Core.dll assemblies.

5. We now have to let NavXp there's a new plugin it should load. Open file/DesktopModules/NavXp/Plugins/.ExternalPlugins.xml in a text editor and add a new PluginClass node that references your class using Namespace.Class,AssemblyName convention.

The file should now look like this:

<?xml version="1.0" encoding="utf-8"?>
<ExternalPlugins>
<PluginClass>avt.NavXp.TestPlugin.MyPlugin,avt.NavXp.TestPlugin</PluginClass>
</ExternalPlugins>
Comments