/// <summary>
        /// Processes the Click event from the button.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">An EventArgs containing the event data.</param>
        protected virtual void OnClick(object sender, EventArgs e)
        {
            // Generate click event for the page header
            Navigator.OnTabClicked(new KryptonPageEventArgs(_page, Navigator.Pages.IndexOf(_page)));

            // If this click is within the double click time of the last one, generate the double click event.
            DateTime now = DateTime.Now;

            if ((now - _lastClick).TotalMilliseconds < SystemInformation.DoubleClickTime)
            {
                // Tell button controller to abort any drag attempt
                _buttonController.ClearDragRect();

                // Generate click event for the page header
                Navigator.OnTabDoubleClicked(new KryptonPageEventArgs(_page, Navigator.Pages.IndexOf(_page)));

                // Prevent a third click causing another double click by resetting the now time backwards
                now = now.AddDays(-1);
            }

            _lastClick = now;

            // Can only select the page if not already selected and allowed to have a selected tab
            if ((_navigator.SelectedPage != _page) && _navigator.AllowTabSelect)
            {
                // This event might have caused the page to be removed or hidden and so check the page is still present before selecting it
                if (_navigator.ChildPanel.Controls.Contains(_page) && _page.LastVisibleSet)
                {
                    _navigator.SelectedPage = _page;
                }
            }
        }
Пример #2
0
        private void OnClick(object sender, EventArgs e)
        {
            // Generate click event for the page header
            Navigator.OnTabClicked(new KryptonPageEventArgs(_page, Navigator.Pages.IndexOf(_page)));

            // If this click is within the double click time of the last one, generate the double click event.
            DateTime now = DateTime.Now;

            if ((now - _lastClick).TotalMilliseconds < SystemInformation.DoubleClickTime)
            {
                // Tell button controller to abort any drag attempt
                _buttonController.ClearDragRect();

                // Generate click event for the page header
                Navigator.OnTabDoubleClicked(new KryptonPageEventArgs(_page, Navigator.Pages.IndexOf(_page)));

                // Prevent a third click causing another double click by resetting the now time backwards
                now = now.AddDays(-1);
            }

            _lastClick = now;

            // Can only select the page if not already selected and allowed a selected tab
            if ((Navigator.SelectedPage != _page) && Navigator.AllowTabSelect)
            {
                Navigator.SelectedPage = _page;
            }

            // If the page is actually now selected
            if (Navigator.SelectedPage == _page)
            {
                // If in a tabs only mode then show the popup for the page
                if (Navigator.NavigatorMode == NavigatorMode.BarRibbonTabOnly)
                {
                    Navigator.ShowPopupPage(Page, this, null);
                }
            }
        }