Hi,
I am trying to write a plug in which is targeted at My Derived Model. However, no matter what i do the PlugIn does not appear on the context menu.
Note that i am using LLBLGen v5
Could you advise if i am missing something important in my code:
(Note that i have added lots of TargetTypes here just to see if i could get the plug in showing up somewhere in the context menu. However it is only intended for use with My DerivedModel)
public class DataMemberOrderingPlugIn : PluginBase
{
private const string _build = "1.0.0";
private const string _version = "1.0.0";
private Control _control;
public override PluginDescription Describe()
{
PluginDescription toReturn = base.Describe();
toReturn.Build = _build;
toReturn.Description = "General plug-in to add ordering to Derived Model Data Members";
toReturn.Id = new Guid("{9FF8F454-69B9-4E35-B158-96E13C1F3F40}");
toReturn.Name = "Add Data Member Ordering Plug-in";
toReturn.ShowProgressViewerDuringExecution = true;
toReturn.TargetType = PluginTargetType.SPCall | PluginTargetType.Entity |
PluginTargetType.Project | PluginTargetType.ValueType |
PluginTargetType.TypedList | PluginTargetType.TypedView | PluginTargetType.DerivedModel;
toReturn.TypeOfPlugin = PluginType.SingleAndMultiElementPlugin;
toReturn.Vendor = "TopDog74";
toReturn.Version = _version;
return toReturn;
}
public override System.Windows.Forms.Control GetConfigurationControl()
{
_control = new DataMemberOrderingPlugInForm(this);
return _control;
}
public override void Execute()
{
base.ProgressTaskStart("Processing Derived Models");
base.ProgressSubtaskInit(this.Entities.Count);
//get all the derived models
foreach (var derivedModel in this.Entities)
{
base.ProgressSubtaskStart("Processing Class: " + derivedModel.Name);
ProcessSingleEntity(derivedModel);
base.LogLineToApplicationOutput("Added Data Member Ordering to class: " + derivedModel.Name, "Add Data Member Ordering PlugIn", true);
base.ProgressSubtaskComplete();
}
base.ProgressTaskComplete();
}
private void ProcessSingleEntity(EntityDefinition derivedModel)
{
//not relevant to question
}
}
The code for the form is like this: (Note that i will probably remove this and make the plug in a DirectRun type, however i wanted to get a form working with it in case i need to go down this route for something in the future also)
public partial class DataMemberOrderingPlugInForm : Form, IPluginConfigurationControl
{
private DataMemberOrderingPlugIn _pluginInstance;
public DataMemberOrderingPlugInForm(DataMemberOrderingPlugIn pluginInstance)
{
InitializeComponent();
_pluginInstance = pluginInstance;
}
public event EventHandler DataIsInvalid;
public event EventHandler DataIsValid;
public Guid FormID
{
get
{
return new Guid("{9FF8F454-69B9-4E35-B158-96E13C1F3F40}");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
public Guid PluginID
{
get
{
return _pluginInstance.Describe().Id;
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
private void btnRunTool_Click(object sender, EventArgs e)
{
if (DataIsValid != null) DataIsValid(this, e);
}
}
I cant debug my Execute code until i figure out why it is not appearing on the context menu for it's target type(s).
On loading of the project the output window tells me that the Plugin does get successfully loaded. - "PluginStore::Successfully loaded plug-in 'Add Data Member Ordering Plug-in' from assembly file 'F:\PlugInPractice\Model\Template\AdditionalPlugins\LLBLGenPlugIns.dll'."
Thanks,
Iain