コード例 #1
0
        protected override void OnClick(ExecuteRoutedEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            // Ignore the base code so that a command is not raised

            if (IsPopupOpen)
            {
                // Only close the popup if not a menu item
                if (Context != GameControlContext.MenuItem)
                {
                    IsPopupOpen = false;
                }
            }
            else
            {
                // Fire the command
                GameCommand.ExecuteCommandSource(this);

                // Flag if the popup is being opened with the mouse
                ((IGamePopupAnchor)this).PopupOpenedWithMouse = (e.Reason == ExecuteReason.Mouse);

                // Open the popup
                IsPopupOpen = true;
            }
        }
コード例 #2
0
        protected virtual void OnClick(ExecuteRoutedEventArgs e)
        {
            e.RoutedEvent = ClickEvent;
            e.Source      = this;

            RaiseEvent(e);

            GameCommand.ExecuteCommandSource(this);
        }