Ejemplo n.º 1
0
        /// <summary>
        /// Updates the buttons bitmap according to mode
        /// </summary>
        private void UpdateBitmap()
        {
            Trace.WriteLine("enter UpdateBitmap");
            try
            {
                ICommandItem commandItem = ArcMap.Application.Document.CommandBars.Find("Umbriel_Project_Umbriel.ArcMap.Addin.EditorTrack_EditorTrackToggleButton", true, true);

                if (EditorTrackHelper.extensionEnabled)
                {
                    Trace.WriteLine("Setting Enabled BitMap");
                    commandItem.FaceID = this.onBitmapPictureDisp;
                    commandItem.Refresh();
                    Trace.WriteLine("After Enabled BitMap Refresh.");
                }
                else
                {
                    Trace.WriteLine("Setting Disabled BitMap");
                    commandItem.FaceID = this.offBitmapPictureDisp;
                    commandItem.Refresh();
                    Trace.WriteLine("After Disabled BitMap Refresh.");
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Trace.WriteLine(e.StackTrace);
                throw;
            }

            Trace.WriteLine("exit  UpdateBitmap");
        }
Ejemplo n.º 2
0
        private void AddMenu()
        {
            ICommandBar mainMenuBar = GetMainBar();

            if (mainMenuBar == null)
            {
                return;
            }

            string       menuID  = "BathymetryTools";
            ICommandItem cmdItem = mainMenuBar.Find(menuID, false);

            if (cmdItem != null)
            {
                return;
            }

            UID uid = new UID();

            uid.Value = menuID;
            Object       index          = mainMenuBar.Count - 1;
            ICommandBar  menuBathymetry = mainMenuBar.Add(uid, index) as ICommandBar;
            ICommandItem main           = mainMenuBar as ICommandItem;

            main.Refresh();
        }
Ejemplo n.º 3
0
        private void AddCommandToApplicationMenu(IApplication TheApplication, string AddThisCommandGUID,
                                                 string ToThisMenuGUID, bool StartGroup, string PositionAfterThisCommandGUID, string PositionBeforeThisCommandGUID, bool EndGroup)
        {
            if (AddThisCommandGUID.Trim() == "")
            {
                return;
            }

            if (ToThisMenuGUID.Trim() == "")
            {
                return;
            }

            //Then add items to the command bar:
            UID pCommandUID = new UIDClass();       // this references an ICommand from my extension

            pCommandUID.Value = AddThisCommandGUID; // the ICommand to add

            //Assign the UID for the menu we want to add the custom button to
            UID MenuUID = new UIDClass();

            MenuUID.Value = ToThisMenuGUID;
            //Get the target menu as a ICommandBar
            ICommandBar pCmdBar = TheApplication.Document.CommandBars.Find(MenuUID) as ICommandBar;

            int iPos = pCmdBar.Count;

            //for the position string, if it's an empty string then default to end of menu.
            if (PositionAfterThisCommandGUID.Trim() != "")
            {
                UID pPositionCommandUID = new UIDClass();
                pPositionCommandUID.Value = PositionAfterThisCommandGUID;
                iPos = pCmdBar.Find(pPositionCommandUID).Index + 1;
            }

            if (iPos == pCmdBar.Count && PositionBeforeThisCommandGUID.Trim() != "") //prioritize the "after" case
            {
                UID pPositionCommandUID = new UIDClass();
                pPositionCommandUID.Value = PositionBeforeThisCommandGUID;
                iPos = pCmdBar.Find(pPositionCommandUID).Index;
            }

            ICommandItem pCmdItem = pCmdBar.Find(pCommandUID);

            //Check if it is already present on the context menu...
            if (pCmdItem == null)
            {
                pCmdItem       = pCmdBar.Add(pCommandUID, iPos);
                pCmdItem.Group = StartGroup;
                pCmdItem.Refresh();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates the buttons bitmap according to mode
        /// </summary>
        private void UpdateBitmap()
        {
            try
            {
                ICommandItem commandItem = ArcMap.Application.Document.CommandBars.Find("Umbriel_Project_Umbriel.ArcMap.Addin.OneSelectableLayer_OneSelectableLayerButton", true, true);

                if (this.forceOneSelectableLayerOn)
                {
                    commandItem.FaceID = this.onBitmapPictureDisp;
                    commandItem.Refresh();
                }
                else
                {
                    commandItem.FaceID = this.offBitmapPictureDisp;
                    commandItem.Refresh();
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Trace.WriteLine(e.StackTrace);
                throw;
            }
        }