/// <summary>
        /// Fired when any <see cref="SimpleButton"/> contained in the ApplicationMenu
        /// bottom pane is clicked. If the SimpleButton.Tag property contains an
        /// active EventTopicName string, that event is fired.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/>
        /// instance containing the event data.</param>
        private void ButtonClick(object sender, EventArgs e)
        {
            /* •———————————————————————————————————————————————————————————————•
            | Here is the whole reason for handling the ApplicationMenu     |
            | bottom pane with events. We need to hide the application      |
            | menu popup if any button will cause a modal dialog to appear. |
            | Since the standard two items added to the bttom pane are the  |
            | application exit and application options, we need to close    |
            | the application menu popup prior to launching the modal       |
            | options dialog.                                               |
            |  •———————————————————————————————————————————————————————————————• */
            applicationMenu.HidePopup();

            if (!(sender is SimpleButton))
            {
                return;
            }
            SimpleButton button = sender as SimpleButton;

            if (button.Tag != null && button.Tag is string)
            {
                string     eventTopicName = button.Tag as string;
                EventTopic eventTopic     = workItem.EventTopics[eventTopicName];
                if (eventTopic != null)
                {
                    eventTopic.Fire(sender, new EventArgs(), null, PublicationScope.Global);
                }
            }
        }
示例#2
0
        private void menuClicked(object sender, EventArgs e)
        {
            var ml          = sender.DowncastTo <AppMenuFileLabel>();
            var menuBarItem = ml.Tag.DowncastTo <IMenuBarButton>();

            _applicationMenu.HidePopup();
            menuBarItem.Click();
        }