예제 #1
0
        public NavbarOption GetOption(string currentItem, int idx = -1, List <NavbarOption> options = null)
        {
            NavbarOption _navbarOption = null;

            char[]   delimiters = { '/' };
            string[] _parts     = currentItem.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);

            int _idx = idx == -1 ? 0 : idx;
            List <NavbarOption> _options = options != null ? options : this.Options;

            foreach (NavbarOption navbarOption in _options)
            {
                if (_parts[_idx] == navbarOption.Name)
                {
                    if ((_idx + 1) < _parts.Length)
                    {
                        if (navbarOption.Options.Count > 0)
                        {
                            _navbarOption = GetOption(currentItem, _idx + 1, navbarOption.Options);
                            if (_navbarOption != null)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        _navbarOption = navbarOption;
                        break;
                    }
                }
            }
            return(_navbarOption);
        }
예제 #2
0
        /*==================================================================================================================================
        * Properties
        *=================================================================================================================================*/
        #endregion


        #region Public Methods

        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus SetCurrentItem(string currentItem)
        {
            NavbarOption navbarOption = GetOption(currentItem);

            if (navbarOption != null)
            {
                navbarOption.bCurrentItem = true;
            }
            else
            {
                return(new questStatus(Severity.Warning, "Option not found"));
            }
            return(new questStatus(Severity.Success));
        }