I want to move from a winform app to a paletteset. I have public methods and properties I have created in my Winform however after moving my code over to a palette (user control) I no longer have access to those public methods through the Paletteset?! Here is some Pseudo code...
(note: I have this posed here as well :
http://forums.autodesk.com/t5/net/paletteset-and-palette-newbie-question/td-p/5525512)
public class MyPlugin : IExtensionApplication {
private Document m_Adoc;
private PaletteSet m_PaletteSet = null;
private System.Windows.Forms.Control m_ucPalette = null;
void IExtensionApplication.Initialize() {
Application.DocumentManager.DocumentActivated += new DocumentCollectionEventHandler(MonitorDocumentActivated);
if (Application.DocumentManager.Count > 0) {
this.m_Adoc = Application.DocumentManager.GetDocument(HostApplicationServices.WorkingDatabase);
}
}
void IExtensionApplication.Terminate() {
this.UnloadPlugin();
}
private void MonitorDocumentActivated(object sender, DocumentCollectionEventArgs e) {
if (e.Document != null) {
this.m_Adoc = e.Document;
if (!this.m_Adoc.IsReadOnly) this.LoadPlugin();
} else {
if (m_MyPalettset != null) { this.UnloadPlugin(); }
}
}
private void LoadPlugin() {
if (Tools.IsRegApp()) {
this.LoadPalettset();
} else {
//do something else here....
}
}
private void LoadPalettset() {
this.m_PaletteSet = new PaletteSet("Earthbound Designator Tool", Guid.Parse(guid));
this.m_PaletteSet.Style = PaletteSetStyles.ShowPropertiesMenu | PaletteSetStyles.ShowAutoHideButton | PaletteSetStyles.Snappable;
this.m_ucPalette = new MyPalette();
this.m_PaletteSet.Add("ucPalette", m_ucPalette);
this.m_PaletteSet.MinimumSize = new System.Drawing.Size(350, 535);
this.m_PaletteSet.SetSize(new System.Drawing.Size(350, 535));
this.m_PaletteSet.EnableTransparency(true);
this.m_PaletteSet.Location = new System.Drawing.Point(400, 400);
this.m_PaletteSet.Visible = true;
this.m_PaletteSet.DockEnabled = DockSides.None | DockSides.Left | DockSides.Right;
this.m_PaletteSet.Dock = DockSides.None;
this.m_PaletteSet.StateChanged += new PaletteSetStateEventHandler(MonitorPaletteState);
// so let's say for example I wanted to call a custom method I have exposed in m_ucPalette
// how would I access that method from here?
//Or for that matter how would I gain access to any of the other controls on the palette?// note: for this exercise I am trying to understand how to communicate between this InitClass and the controls on the Paletteset.
}
private void UnLoadPlugin() {...}
}
Thank you!