IDockChangeListener Interface

What commandstate and eventhandler that enables the IDockChangeListener inteface?

Dim cls As clsDockChangeListner cls = New clsDockChangeListner

where the class is...

Imports Bentley.WindowingPublic Class clsDockChangeListner

Implements Bentley.Windowing.Docking.IDockChangeListener

 ...

 End Class

for example.

The command...

ustn.CommandState.StartLocate cls

enables the

Implements ILocateCommandEvents

Sub StartLocate(EventHandlers As Bentley.Interop.MicroStationDGN.ILocateCommandEvents) Member of Bentley.Interop.MicroStationDGN.CommandState

and ustn.CommandState.StartPrimitive(cls) enables the

Implements IPrimitiveCommandEvents Sub StartPrimitive(EventHandlers As Bentley.Interop.MicroStationDGN.IPrimitiveCommandEvents, Optional WantKeyins As Boolean = Nothing) Member of Bentley.Interop.MicroStationDGN.CommandState

  • Here is a snip of some code that I used for the IDockChangeListener interface:

    using System;

    using System.IO;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Linq;

    using System.Text;

    using SWF = System.Windows.Forms;

    #region "Bentley Namespaces"

    using BMW = Bentley.MicroStation.WinForms;

    using BMI = Bentley.MicroStation.InteropServices;

    using BCOM = Bentley.Interop.MicroStationDGN;

    using BM = Bentley.MicroStation;

    using BW = Bentley.Windowing;

    using BWD = Bentley.Windowing.Docking;

    #endregion

    namespace Initaddin

    {

       public partial class InitForm : BMW.Adapter, BWD.IDockChangeListener //System.Windows.Forms.Form//

       {

           private BW.WindowContent m_windowContent;

           private string m_baseDirectory;

           private string m_fileName;

           public InitForm(BM.AddIn addIn)

           {

               //AttachAsGuiDockable(addIn, this.Text);

              // textBox1.Text = "c:\\ddrive\\data\\dgn\\";

               AttachAsTopLevelForm(addIn, true);

               this.Width = 300;

           /* Make the form dockable in MicroStation */

               this.NETDockable = true;

               BW.WindowManager windowManager = BW.WindowManager.GetForMicroStation();

               m_windowContent = windowManager.DockPanel(this, this.Name, this.Text, BW.DockLocation.Left);

               //m_windowContent.Undockable = true;

               //m_windowContent.CanAutoHide = true;

               //m_windowContent.CanDockHorizontally = false;

               InitializeComponent();

               populateFileList();

           }

           public System.Windows.Forms.ListBox GetListBox()

           {

               return listBox1;

           }

           private int populateFileList()

           {

               string[] listing;

               m_baseDirectory = "c:\\ddrive\\data\\dgn\\";

               listing = Directory.GetFiles(m_baseDirectory, "*.dgn");

               foreach (string file in listing)

                   listBox1.Items.Add(file);

               //listView1.View = SWF.View.List;

               //listView1.Dock = SWF.DockStyle.Fill;

               return listing.Count();

           }

           private void SelectedItem(object sender, SWF.MouseEventArgs e)

           {

               string fileName = listBox1.SelectedItems[0].ToString();

               BMI.Utilities.ComApp.OpenDesignFile(fileName, false, BCOM.MsdV7Action.UpgradeToV8);

              // this.Hide();

           }

           /*------------------------------------------------------------------------------------**/

           /// <summary>See IDockChangeListener.</summary>

           ///

           /// <author>Wil.Maier</author>                                <date>08/2008</date>

           /*--------------+---------------+---------------+---------------+---------------+------*/

           public void OnUndocked

           (

           SWF.Control newParent

           )

           {

           }

           /*------------------------------------------------------------------------------------**/

           /// <summary>See IDockChangeListener.</summary>

           ///

           /// <author>Wil.Maier</author>                                  <date>08/2008</date>

           /*--------------+---------------+---------------+---------------+---------------+------*/

           public void OnDocked

           (

           SWF.Control newParent,

           SWF.DockStyle where

           )

           {

           }

           /*------------------------------------------------------------------------------------**/

           /// <summary>See IDockChangeListener.</summary>

           ///

           /// <author>Wil.Maier</author>                                  <date>08/2008</date>

           /*--------------+---------------+---------------+---------------+---------------+------*/

           public void OnDocking

           (

           SWF.Control newParent,

           SWF.DockStyle where

           )

           {

           }

           /*------------------------------------------------------------------------------------**/

           /// <summary>See IDockChangeListener.</summary>

           ///

           /// <author>Wil.Maier</author>                                  <date>08/2008</date>

           /*--------------+---------------+---------------+---------------+---------------+------*/

           public void OnUndocking

           (

           SWF.Control newParent

           )

           {  

           }

           /*------------------------------------------------------------------------------------**/

           /// <summary>See IDockChangeListener.</summary>

           ///

           /// <author>Wil.Maier</author>                                  <date>08/2008</date>

           /*--------------+---------------+---------------+---------------+---------------+------*/

           public void OnParentClosing

           (

           System.ComponentModel.CancelEventArgs args

           )

           {

           }

           private void listBox1_MouseDoubleClick(object sender, SWF.MouseEventArgs e)

           {

               SelectedItem(sender, e);

           }

       }

    }

    HTH,