- Home
- LLBLGen Pro
- LLBLGen Pro Runtime Framework
Plugin Issues
Posts
Posts: 35
Joined: 19-Nov-2011
Joined: 19-Nov-2011
# Posted on: 29-Aug-2013 23:42:03
Hi,
I'm attempting to write my own plugin and everything seems straight forward, however I can't seem to get the Run button enabled when the dialog pops up despite raising the DataIsValid event. I don't have any Plugin Settings related items to add to a Control so I'm just going through the motions to satisfy the requirements. Can anybody help please?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SD.LLBLGen.Pro.ApplicationCore;
namespace MyProject
{
public partial class MyControl: UserControl, IPluginConfigurationControl
{
public event EventHandler DataIsInvalid;
public event EventHandler DataIsValid;
public MyControl()
{
InitializeComponent();
this.DataIsValid += new EventHandler(DoNothing);
if (DataIsValid != null)
{
DataIsValid(this, new EventArgs());
}
}
public void DoNothing(object o, EventArgs e) { }
}
}
# Posted on: 30-Aug-2013 08:26:05
Your plugin form (not control) should look like (taken from ProjectInspector plugin):
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SD.LLBLGen.Pro.ApplicationCore;
namespace SD.LLBLGen.Pro.Plugins
{
public partial class ProjectInspectorPluginForm : Form, IPluginWindow
{
#region Class Member Declarations
private ProjectInspectorPlugin _pluginInstance;
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="ProjectInspectorPluginForm"/> class.
/// </summary>
/// <param name="pluginInstance">The plugin instance.</param>
public ProjectInspectorPluginForm(ProjectInspectorPlugin pluginInstance)
{
InitializeComponent();
_pluginInstance = pluginInstance;
_stateBrowserControl.ObjectToBrowse = _pluginInstance.ProjectToTarget;
}
#region EventHandlers
private void _stateBrowserControl_ShowDataTypesChanged( object sender, EventArgs e )
{
chkDataTypes.Checked = _stateBrowserControl.ShowDataTypes;
}
private void _stateBrowserControl_ShowNonPublicMembersChanged( object sender, EventArgs e )
{
chkNonPublicMembers.Checked = _stateBrowserControl.ShowNonPublicMembers;
}
private void _stateBrowserControl_ShowStaticMembersChanged( object sender, EventArgs e )
{
chkStaticMembers.Checked = _stateBrowserControl.ShowStaticMembers;
}
private void chkStaticMembers_CheckedChanged( object sender, EventArgs e )
{
_stateBrowserControl.ShowStaticMembers = chkStaticMembers.Checked;
}
private void chkNonPublicMembers_CheckedChanged( object sender, EventArgs e )
{
_stateBrowserControl.ShowNonPublicMembers = chkNonPublicMembers.Checked;
}
private void chkDataTypes_CheckedChanged( object sender, EventArgs e )
{
_stateBrowserControl.ShowDataTypes = chkDataTypes.Checked;
}
private void _stateBrowserControl_NodeSelected( object sender, EventArgs e )
{
_selectedObjectPropertyGrid.SelectedObject = sender;
}
#endregion
#region Class Property Declarations
/// <summary>
/// The unique ID for the implementing form. This ID is used to find back an already open form instance.
/// </summary>
/// <value></value>
public Guid FormID
{
get
{
return new Guid( "{08F8C6A0-30B8-479f-BFB0-95139E6B7B3A}" );
}
set
{
throw new Exception( "The method or operation is not implemented." );
}
}
/// <summary>
/// The ID of the plugin which opened the IPluginWindow instance.
/// </summary>
/// <value></value>
public Guid PluginID
{
get
{
return _pluginInstance.Describe().Id;
}
set
{
throw new Exception( "The method or operation is not implemented." );
}
}
#endregion
}
And of course you need the actual plugin class
namespace SD.LLBLGen.Pro.Plugins
{
/// <summary>
/// ProjectInspectorPlugin implementation, opens a docked window in the designer to inspect a Project object's detailed object model.
/// </summary>
public class ProjectInspectorPlugin : PluginBase
{
...