3

I have this code to know if a toolbar is displaying:

IApplication m_aplication = ArcMap.Application;

ICommandBar versionToolbar = GetToolbarByName(m_aplication, "esriArcMapUI.VersionToolbar");

if (versionToolbar.IsVisible()){
    versionToolbar.Dock(esriDockFlags.esriDockHide);
}

I can hide a toolbar, but I need to know when a toolbar is added to the desktop view, for example when the user check a toolbar in customize option:

enter image description here

I have this extension class:

public sealed class eManager : ESRI.ArcGIS.Desktop.AddIns.Extension
    {
       protected override void OnStartup()
       {
            MessageBox.Show("on Start up eManager");
       }
    }

And this config extension: enter image description here

but the event doesn't work

1

The status of the toolbar you can only check if your toolbar is part of an extension. There is a bit more work to implement. In Add Item-dialog in your Visual-Studio project you can choose the template Application Extension (Desktop) of Extending ArcObjects category.

  • Hi, I edited my question adding my extension class, and configuration. I put a message on start up, but it isn't showing. – Pilgrim May 8 '17 at 14:20
  • don't use ESRI.ArcGIS.Desktop.AddIns.Extension, I meant ESRI.ArcGIS.esriSystem.IExtension, so you can implement the IExtensionConfig Interface and use from there the State-Member. – Ms. Smith May 15 '17 at 8:38
  • look here for the State-Member – Ms. Smith May 15 '17 at 8:52
  • Thanks, I made a timer. But when a I have to change it, I gonna try with a IExtension class, and if works, I'll check your answer. Regards – Pilgrim May 15 '17 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.