Example #1
0
 public bool Equals(MenuItemToken other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.Key, Key) && Equals(other.Text, Text) && Equals(other.Url, Url) && Equals(other.MenuItemState, MenuItemState));
 }
Example #2
0
        // TODO -- this could really use some more end to end testing
        public MenuItemToken BuildToken(MenuNode node)
        {
            var token = new MenuItemToken {
                Children      = node.Children.Select(BuildToken).ToArray(),
                Key           = node.Key.Key,
                Text          = node.Key.ToString(),
                Category      = node.Category,
                MenuItemState = _stateService.DetermineStateFor(node)
            };

            if (node.Icon().IsNotEmpty())
            {
                token.IconUrl = _urls.FindImageUrl(node.Icon());
            }

            if (node.Type == MenuNodeType.Leaf)
            {
                token.Url = _urlResolver.UrlFor(node.UrlInput, node.BehaviorChain);
            }

            node.ForData(token.Set);

            return(token);
        }
Example #3
0
 public MenuItemToken()
 {
     Url      = string.Empty;
     Children = new MenuItemToken[0];
     Data     = new Dictionary <string, object>();
 }