private void MenuItem_BeforePopup(object sender, MenuPopupEventArgs e)
        {
            try {
                if (sender == this.contextMenuBarItemGrid)
                {
                    // Get Selected Property Grid
                    PropertyGrid propertyGrid = null;
                    if (e.Control != null && e.Control is PropertyGrid)
                    {
                        propertyGrid = (PropertyGrid)e.Control;
                    }

                    // Enable/Check Menu Items
                    this.menuButtonItemReset.Enabled       = propertyGrid != null && propertyGrid.SelectedGridItem != null;
                    this.menuButtonItemDescription.Enabled = propertyGrid != null;
                    this.menuButtonItemDescription.Checked = propertyGrid != null && propertyGrid.HelpVisible;

                    // Store Reference of Selected PropertyGrid
                    this.menuButtonItemReset.Tag       = propertyGrid;
                    this.menuButtonItemDescription.Tag = propertyGrid;
                }
            }
            catch (Exception ex) {
                ExceptionDialog.HandleException(ex);
            }
        }
Exemple #2
0
        /// <summary>
        /// Update MRU list when MRU menu item parent is opened
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnMRUParentPopup(object sender, MenuPopupEventArgs e)
        {
            // remove all childs
            if (menuItemMRU.HasChildren)
            {
                menuItemMRU.Items.Clear();
            }

            // Disable menu item if MRU list is empty
            if (mruList.Count == 0)
            {
                menuItemMRU.Enabled = false;
                return;
            }

            // enable menu item and add child items
            menuItemMRU.Enabled = true;

            MenuButtonItem item;

            IEnumerator myEnumerator = mruList.GetEnumerator();

            while (myEnumerator.MoveNext())
            {
                item = new MenuButtonItem(GetDisplayName((string)myEnumerator.Current));

                // subscribe to item's Click event
                item.Activate += new EventHandler(this.OnMRUClicked);

                menuItemMRU.Items.Add(item);
            }
        }
 private void MenuBarItem_BeforePopup(object sender, MenuPopupEventArgs e)
 {
     if (sender == this.menuBarItemFile)
     {
         this.menuButtonItemExit.Enabled = true;
     }
 }
 private void MenuItem_BeforePopup(object sender, MenuPopupEventArgs e)
 {
     try {
         if (sender == this.contextMenuBarItemGrid)
         {
             // Enable/Check Menu Items
             this.menuButtonItemReset.Enabled       = this.propertyPrinter.SelectedGridItem != null;
             this.menuButtonItemDescription.Enabled = true;
             this.menuButtonItemDescription.Checked = this.propertyPrinter.HelpVisible;
         }
     }
     catch (Exception ex) {
         ExceptionDialog.HandleException(ex);
     }
 }
Exemple #5
0
        /// <summary>
        /// Update MRU list when MRU menu item parent is opened
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnMRUParentPopup(object sender, MenuPopupEventArgs e)
        {
            // remove all childs
            if ( menuItemMRU.HasChildren )
            {
                menuItemMRU.Items.Clear();
            }

            // Disable menu item if MRU list is empty
            if ( mruList.Count == 0 )
            {
                menuItemMRU.Enabled = false;
                return;
            }

            // enable menu item and add child items
            menuItemMRU.Enabled = true;

            MenuButtonItem item;

            IEnumerator myEnumerator = mruList.GetEnumerator();

            while ( myEnumerator.MoveNext() )
            {
                item = new MenuButtonItem(GetDisplayName((string)myEnumerator.Current));

                // subscribe to item's Click event
                item.Activate += new EventHandler(this.OnMRUClicked);

                menuItemMRU.Items.Add(item);
            }
        }
 private void MenuItem_BeforePopup(object sender, MenuPopupEventArgs e) {
     try {
         if (sender == this.contextMenuBarItemGrid) {
             // Enable/Check Menu Items
             this.menuButtonItemReset.Enabled = this.propertyPrinter.SelectedGridItem != null;
             this.menuButtonItemDescription.Enabled = true;
             this.menuButtonItemDescription.Checked = this.propertyPrinter.HelpVisible;
         }
     }
     catch (Exception ex) {
         ExceptionDialog.HandleException(ex);
     }
 }
        private void MenuItem_BeforePopup(object sender, MenuPopupEventArgs e) {
            try {
                if (sender == this.contextMenuBarItemGrid) {
                    // Get Selected Property Grid
                    PropertyGrid propertyGrid = null;
                    if (e.Control != null && e.Control is PropertyGrid) { 
                        propertyGrid = (PropertyGrid)e.Control;
                    }

                    // Enable/Check Menu Items
                    this.menuButtonItemReset.Enabled = propertyGrid != null && propertyGrid.SelectedGridItem != null;
                    this.menuButtonItemDescription.Enabled = propertyGrid != null;
                    this.menuButtonItemDescription.Checked = propertyGrid != null && propertyGrid.HelpVisible;

                    // Store Reference of Selected PropertyGrid
                    this.menuButtonItemReset.Tag = propertyGrid;
                    this.menuButtonItemDescription.Tag = propertyGrid;
                }
            }
            catch (Exception ex) {
                ExceptionDialog.HandleException(ex);
            }
        }
 private void MenuBarItem_BeforePopup(object sender, MenuPopupEventArgs e) {
     if (sender == this.menuBarItemFile) {
         this.menuButtonItemExit.Enabled = true;
     }
 }