WireCAD.IPluginCore

From WireCAD Online Help
Revision as of 19:53, 3 December 2016 by Wirecadadmin (Talk | contribs)

Jump to: navigation, search

WireCAD.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
       #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
   }
}