예제 #1
0

        
예제 #2
0
        public JsonObjectViewModel(JsonObject model, JsonObjectViewModel parentVM)
        {
            Model    = model ?? throw new ArgumentNullException(nameof(model));
            ParentVM = parentVM;

            _isExpanded = false;
            _isSelected = false;
        }
예제 #3
0
        private JsonObjectViewModel Transform(JsonObject root, JsonObjectViewModel parentVM, ref Dictionary <JsonObject, List <JsonObjectViewModel> > map)
        {
            if (root == null)
            {
                throw new ArgumentNullException();
            }

            var rootVM = new JsonObjectViewModel(root, parentVM);

            map.Add(root, new List <JsonObjectViewModel> {
                rootVM
            });

            foreach (var child in root.Fields)
            {
                rootVM.Fields.Add(Transform(child, rootVM, ref map));
            }

            return(rootVM);
        }