コード例 #1
0
        /// <summary>
        ///     Controls call this to leave menu mode.
        ///</summary>
        public void PopMenuMode(PresentationSource menuSite)
        {
            if (menuSite == null)
            {
                throw new ArgumentNullException("menuSite");
            }
            menuSite.VerifyAccess();

            if (_menuModeCount <= 0)
            {
                throw new InvalidOperationException();
            }

            menuSite.PopMenuMode();
            _menuModeCount -= 1;

            if (0 == _menuModeCount)
            {
                EventHandler leaveMenuMode = LeaveMenuMode;
                if (null != leaveMenuMode)
                {
                    leaveMenuMode(null, EventArgs.Empty);
                }
            }
        }
コード例 #2
0
        /// <summary>
        ///     Controls call this to enter menu mode.
        ///</summary>
        public void PushMenuMode(PresentationSource menuSite)
        {
            if (menuSite == null)
            {
                throw new ArgumentNullException("menuSite");
            }
            menuSite.VerifyAccess();

            menuSite.PushMenuMode();
            _menuModeCount += 1;

            if (1 == _menuModeCount)
            {
                EventHandler enterMenuMode = EnterMenuMode;
                if (null != enterMenuMode)
                {
                    enterMenuMode(null, EventArgs.Empty);
                }
            }
        }