コード例 #1
0
        /// <summary> Gets the parameters required for selecting the <paramref name="menuTab"/>. </summary>
        /// <param name="menuTab">
        ///   The <see cref="MenuTab"/> that should be selected by the when using the returned URL parameters.
        ///   Must not be <see langword="null"/>.
        /// </param>
        /// <returns>
        ///   A <see cref="NameValueCollection"/> that contains the URL parameters parameters required by this
        ///   <see cref="TabbedMenu"/>.
        /// </returns>
        public virtual NameValueCollection GetUrlParameters(IMenuTab menuTab)
        {
            ArgumentUtility.CheckNotNull("menuTab", menuTab);

            MainMenuTab mainMenuTab = menuTab as MainMenuTab;
            SubMenuTab  subMenuTab  = menuTab as SubMenuTab;

            string[] tabIDs;
            if (mainMenuTab != null)
            {
                tabIDs = ConvertTabIDsToArray(mainMenuTab, null);
            }
            else if (subMenuTab != null)
            {
                tabIDs = ConvertTabIDsToArray(subMenuTab.Parent, subMenuTab);
            }
            else
            {
                throw new NotSupportedException(string.Format("menuTab is of unsupported type '{0}'.", menuTab.GetType().FullName));
            }

            string value = (string)TypeConversionProvider.Convert(typeof(string[]), typeof(string), tabIDs);

            NameValueCollection urlParameters = new NameValueCollection();

            urlParameters.Add(SelectionID, value);
            return(urlParameters);
        }
コード例 #2
0
        /// <summary> Checks whether the control conforms to the required WAI level. </summary>
        /// <exception cref="WcagException"> Thrown if the control does not conform to the required WAI level. </exception>
        protected virtual void EvaluateWaiConformity()
        {
            if (WcagHelper.Instance.IsWcagDebuggingEnabled() && WcagHelper.Instance.IsWaiConformanceLevelARequired())
            {
                MainMenuTabCollection mainMenuTabs = Tabs;
                for (int mainMenuTabsIdx = 0; mainMenuTabsIdx < mainMenuTabs.Count; mainMenuTabsIdx++)
                {
                    MainMenuTab mainMenuTab = mainMenuTabs[mainMenuTabsIdx];
                    bool        hasMainMenuTabPostBackCommand = mainMenuTab.Command != null &&
                                                                mainMenuTab.Command.Type == CommandType.Event;
                    if (hasMainMenuTabPostBackCommand)
                    {
                        WcagHelper.Instance.HandleError(1, this, string.Format("Tabs[{0}].Command", mainMenuTabsIdx));
                    }

                    SubMenuTabCollection subMenuTabs = mainMenuTab.SubMenuTabs;
                    for (int subMenuTabsIdx = 0; subMenuTabsIdx < subMenuTabs.Count; subMenuTabsIdx++)
                    {
                        SubMenuTab subMenuTab = subMenuTabs[subMenuTabsIdx];
                        bool       hasSubMenuTabPostBackCommand = subMenuTab.Command != null &&
                                                                  subMenuTab.Command.Type == CommandType.Event;
                        if (hasSubMenuTabPostBackCommand)
                        {
                            WcagHelper.Instance.HandleError(
                                1, this, string.Format("Tabs[{0}].SubMenuTabs[{1}].Command", mainMenuTabsIdx, subMenuTabsIdx));
                        }
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        ///   Populates the <see cref="SubMenuTabStrip"/> with the tabs from the selected <see cref="MainMenuTab"/>'s
        ///   <see cref="MainMenuTab.SubMenuTabs"/>.
        /// </summary>
        private void PopulateSubMenuTabStrip()
        {
            _isSubMenuTabStripRefreshed = true;
            MainMenuTab selectedMainMenuItem = SelectedMainMenuTab;

            if (selectedMainMenuItem != null)
            {
                _subMenuTabStrip.Tabs.AddRange(selectedMainMenuItem.SubMenuTabs);
            }
            if (_subMenuTabStrip.SelectedTab == null && _subMenuTabStrip.Tabs.Count > 0)
            {
                _subMenuTabStrip.SetSelectedTabInternal(_subMenuTabStrip.Tabs[0]);
            }
        }
コード例 #4
0
 /// <summary>
 ///   Creates a string array from the IDs of the provided <paramref name="mainMenuTab"/> and
 ///   <paramref name="subMenuTab"/>.
 /// </summary>
 /// <param name="mainMenuTab">
 ///   The <see cref="MainMenuTab"/>. If <see langword="null"/>, an empty array will be returned.
 /// </param>
 /// <param name="subMenuTab"> The <see cref="SubMenuTab"/>. </param>
 /// <returns> A string array. </returns>
 private string[] ConvertTabIDsToArray(MainMenuTab mainMenuTab, SubMenuTab subMenuTab)
 {
     string[] tabIDs;
     if (mainMenuTab == null)
     {
         tabIDs = new string[0];
     }
     else if (subMenuTab == null)
     {
         tabIDs    = new string[1];
         tabIDs[0] = mainMenuTab.ItemID;
     }
     else
     {
         tabIDs    = new string[2];
         tabIDs[0] = mainMenuTab.ItemID;
         tabIDs[1] = subMenuTab.ItemID;
     }
     return(tabIDs);
 }
コード例 #5
0
 protected internal void SetParent(MainMenuTab parent)
 {
     ArgumentUtility.CheckNotNull("parent", parent);
     _parent = parent;
 }