Example #1
0
        private bool TryGetMetadataForNode(TreeNodeBase <T> node, string key, out object metadata)
        {
            metadata = null;

            var state = _contextState.GetState();

            if (state != null)
            {
                var contextKey = GetContextKey(node, key);
                if (state.ContainsKey(contextKey))
                {
                    metadata = state[contextKey];
                    return(true);
                }
            }

            if (node._metadata != null && node._metadata.ContainsKey(key))
            {
                metadata = node._metadata[key];
                return(true);
            }

            return(false);
        }
Example #2
0
 private static string GetContextKey(TreeNodeBase <T> node, string key)
 {
     return(node.GetHashCode().ToString() + key);
 }