
UID dockWinID = new UIDClass(); dockWinID.Value = ThisAddIn.IDs.DockableWindow1; // Use GetDockableWindow directly as we want the client IDockableWindow not the internal class IDockableWindow dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID); dockWindow.Show(true);
...
protected override void OnClick()
{
UID theUid = new UIDClass();
theUid.Value = ThisAddIn.IDs.dwnMapUnitLegendEditor;
IDockableWindow mapUnitForm = ArcMap.DockableWindowManager.GetDockableWindow(theUid);
mapUnitForm.Show(true);
}
...
/// <summary>
/// Designer class of the dockable window add-in. It contains user interfaces that
/// make up the dockable window.
/// </summary>
public partial class dwnMapUnitLegendEditor : UserControl
{
public dwnMapUnitLegendEditor(object hook)
{
InitializeComponent();
this.Hook = hook;
}
/// <summary>
/// Host object of the dockable window
/// </summary>
private object Hook
{
get;
set;
}
/// <summary>
/// Implementation class of the dockable window add-in. It is responsible for
/// creating and disposing the user interface class of the dockable window.
/// </summary>
public class AddinImpl : ESRI.ArcGIS.Desktop.AddIns.DockableWindow
{
private dwnMapUnitLegendEditor m_windowUI;
public AddinImpl()
{
Console.Write("Something");
}
protected override IntPtr OnCreateChild()
{
m_windowUI = new dwnMapUnitLegendEditor(this.Hook);
return m_windowUI.Handle;
}
protected override void Dispose(bool disposing)
{
if (m_windowUI != null)
m_windowUI.Dispose(disposing);
base.Dispose(disposing);
}
}