Example #1
0
        /// <summary>
        ///   Adds the parameters required for selecting the <paramref name="menuTab"/> to the <paramref name="url"/>.
        /// </summary>
        /// <param name="url"> The URL. Must not be <see langword="null"/> or empty. </param>
        /// <param name="menuTab">
        ///   The <see cref="MenuTab"/> that should be selected by the <paramref name="url"/>.
        ///   Must not be <see langword="null"/>.
        /// </param>
        /// <returns> The <paramref name="url"/> extended with the parameters required by this <see cref="TabbedMenu"/>. </returns>
        public string FormatUrl(string url, MenuTab menuTab)
        {
            ArgumentUtility.CheckNotNullOrEmpty("url", url);

            NameValueCollection urlParameters = GetUrlParameters(menuTab);

            url = UrlUtility.AddParameters(url, urlParameters);
            return(url);
        }
Example #2
0
 /// <summary>
 ///   Handles the click events of the <see cref="MainMenuTabStrip"/> and the <see cref="SubMenuTabStrip"/>.
 /// </summary>
 /// <param name="tab"> The <see cref="MenuTab"/> whose command was clicked. </param>
 private void HandleTabStripClick(MenuTab tab)
 {
     if (tab != null && tab.Command != null)
     {
         if (tab.Command.Type == CommandType.Event)
         {
             OnEventCommandClick(tab);
         }
         else if (tab.Command.Type == CommandType.WxeFunction)
         {
             throw new InvalidOperationException("MenuTab commands of CommandType WxeFunction must always execute on client side.");
         }
     }
 }
Example #3
0
        /// <summary> Fires the <see cref="EventCommandClick"/> event. </summary>
        /// <param name="tab"> The <see cref="MenuTab"/> whose command was clicked. </param>
        protected virtual void OnEventCommandClick(MenuTab tab)
        {
            if (tab != null && tab.Command != null)
            {
                tab.Command.OnClick();
            }

            MenuTabClickEventHandler handler = (MenuTabClickEventHandler)Events[s_eventCommandClickEvent];

            if (handler != null)
            {
                MenuTabClickEventArgs e = new MenuTabClickEventArgs(tab);
                handler(this, e);
            }
        }
        protected override MenuTab GetActiveTab()
        {
            if (_activeTab != null)
            {
                return(_activeTab);
            }

            _activeTab = this;
            if (Command.Type == CommandType.None)
            {
                foreach (SubMenuTab subMenuTab in _subMenuTabs)
                {
                    bool isTabActive     = subMenuTab.EvaluateVisible() && subMenuTab.EvaluateEnabled();
                    bool isCommandActive = subMenuTab.Command != null && subMenuTab.Command.Type != CommandType.None;
                    if (isTabActive && isCommandActive)
                    {
                        _activeTab = subMenuTab;
                        break;
                    }
                }
            }

            return(_activeTab);
        }
 /// <summary> Initializes an instance. </summary>
 public MenuTabClickEventArgs(MenuTab tab)
     : base(tab)
 {
 }