[Plugin("Test#1", "Me", ToolTip = "", DisplayName = "Test")]
public class WPFDockPaneAddin : AddInPlugin
{
public override int Execute(params string[] parameters)
{
if (Application.IsAutomated)
{
throw new InvalidOperationException("Invalid when running using Automation");
}
PluginRecord pr = Application.Plugins.FindPlugin("Test#1.Me");
if (pr is DockPanePluginRecord && pr.IsEnabled)
{
if (pr.LoadedPlugin == null)
{
pr.LoadPlugin();
}
if (pr.LoadedPlugin is DockPanePlugin dpp)
{
dpp.Visible = !dpp.Visible;
var pane = dpp.CreateControlPane();
pane.CreateControl();
pane.Show();
dpp.ActivatePane();
MessageBox.Show("CreateControlPane, isVisible " + dpp.Visible); //Вот тут всегда false
}
}
return 0;
}
}
[Plugin("Test#1", "Me", ToolTip = "", DisplayName = "Test")]
[DockPanePlugin(100, 200, FixedSize = false, MinimumHeight = 100, MinimumWidth = 300)]
public class Class1 : DockPanePlugin
{
protected override bool IsSelfEnabled() => true;
public override Control CreateControlPane()
{
ElementHost eh = new ElementHost();
eh.AutoSize = true;
eh.Child = new UserControl1();
eh.CreateControl();
eh.Visible = true;
return eh;
}
public override void DestroyControlPane(Control pane) => pane.Dispose();
}