Difference between revisions of "WireCAD.IPluginCore"
From WireCAD Online Help
Wirecadadmin (Talk | contribs) (Created page with "WireCAD.IPluginCore This interface must be implemented on any plugin used in WireCAD. The interface follows the form: namespace YourNameSpace { public class YourPlu...") |
Wirecadadmin (Talk | contribs) |
||
(14 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | WireCAD.IPluginCore | + | WireCAD.Interfaces.IPluginCore |
This interface must be implemented on any plugin used in WireCAD. | This interface must be implemented on any plugin used in WireCAD. | ||
Line 7: | Line 7: | ||
namespace YourNameSpace | namespace YourNameSpace | ||
{ | { | ||
− | |||
public class YourPlugin : IPluginCore | public class YourPlugin : IPluginCore | ||
{ | { | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
#region IPluginCore Members | #region IPluginCore Members | ||
− | |||
/// <summary> | /// <summary> | ||
/// Called before plugin is loaded to make sure that this plugin | /// Called before plugin is loaded to make sure that this plugin | ||
Line 35: | Line 22: | ||
return true; | return true; | ||
} | } | ||
− | |||
/// <summary> | /// <summary> | ||
/// This is called when the plugin is loaded at application start | /// This is called when the plugin is loaded at application start | ||
Line 43: | Line 29: | ||
{ | { | ||
//init code goes here | //init code goes here | ||
− | |||
− | |||
} | } | ||
− | |||
− | |||
/// <summary> | /// <summary> | ||
/// Unload code for your plugin | /// Unload code for your plugin | ||
Line 55: | Line 37: | ||
{ | { | ||
//here we place any code to unload our plugin. | //here we place any code to unload our plugin. | ||
− | |||
} | } | ||
− | |||
#endregion | #endregion | ||
+ | [[File:Add edit pi menu.png|200px|thumb|Add/Edit PI Info]] | ||
+ | Though not part of the interface it is customary to include any number of methods that use the method signature below.<br> | ||
+ | These can be called from the commandline if a Command has been registered that points to it.<br> | ||
+ | You can register a Command in code or through a *.wpi file.<br> | ||
+ | To edit a wpi file use the wpi file editor in '''WireCAD Plugins>Plugin Manager [Add/Edit PI Info]...''' <br> | ||
+ | |||
#region Static Methods | #region Static Methods | ||
Line 69: | Line 55: | ||
//do your stuff here | //do your stuff here | ||
} | } | ||
− | |||
#endregion | #endregion | ||
− | |||
} | } | ||
} | } |
Latest revision as of 19:30, 5 December 2016
WireCAD.Interfaces.IPluginCore
This interface must be implemented on any plugin used in WireCAD. The interface follows the form:
namespace YourNameSpace { public class YourPlugin : IPluginCore { #region IPluginCore Members /// <summary> /// Called before plugin is loaded to make sure that this plugin /// has permission to run at this application mode level and /// for this person(Identity) /// </summary> /// <param name="ws">The Singleton Workspace object</param> /// <param name="id">Current user identity</param> /// <returns>should return true if the plug can load</returns> public bool HasPermissionToRun(IWorkspace ws, Identity id) { return true; } /// <summary> /// This is called when the plugin is loaded at application start /// </summary> /// <param name="ws">Singleton WireCAD Workspace object</param> public void Load(IWorkspace ws) { //init code goes here } /// <summary> /// Unload code for your plugin /// </summary> /// <param name="ws"></param> public void Unload(IWorkspace ws) { //here we place any code to unload our plugin. } #endregion
Though not part of the interface it is customary to include any number of methods that use the method signature below.
These can be called from the commandline if a Command has been registered that points to it.
You can register a Command in code or through a *.wpi file.
To edit a wpi file use the wpi file editor in WireCAD Plugins>Plugin Manager [Add/Edit PI Info]...
#region Static Methods /// <summary> /// Static method that can be called from the WireCAD command line /// </summary> /// <param name="ws">WireCAD is expecting to find this parameter</param> public static void MyFirstPluginMethod(Workspace ws) { //do your stuff here } #endregion } }