Beispiel #1
0
        public static TreeViewData CreateNode(CustomTreeView tree, JsonObject jsonObject)
        {
            var children = new List <TreeViewData>();

            foreach (JsonObject child in jsonObject.Children)
            {
                children.Add(CreateNode(tree, child));
            }

            return(new TreeViewData(tree, jsonObject, children));
        }
Beispiel #2
0
        private static List <TreeViewData> CreateList(CustomTreeView tree, JsonObject jsonObject)
        {
            var result = new List <TreeViewData>();

            foreach (JsonObject jsonChildren in jsonObject.Children)
            {
                result.Add(CreateNode(tree, jsonChildren));
            }

            return(result);
        }
Beispiel #3
0
        internal TreeViewData(CustomTreeView tree, JsonObject jsonObject, IList <TreeViewData> children)
        {
            Debug.Assert(System.Threading.Thread.CurrentThread.ManagedThreadId == 1);

            _tree                  = tree;
            _jsonObject            = jsonObject;
            _jsonObject.ViewObject = this;
            _children              = new ObservableCollection <TreeViewData>(children);

            _jsonObject.PropertyChanged                 += OnDataModelPropertyChanged;
            _jsonObject.Rules.PropertyChanged           += OnRulesPropertyChanged;
            Properties.Settings.Default.PropertyChanged += OnSettingsPropertyChanged;

            this.ExpandChildrenCommand   = new ExpandChildrenCommand(this);
            this.ExpandAllCommand        = new ExpandAllCommand(this);
            this.CollapseAllCommand      = new CollapseAllCommand(this);
            this.CopyKeyCommand          = new CopyKeyCommand(this);
            this.CopyValueCommand        = new CopyValueCommand(this);
            this.CopyPrettyValueCommand  = new CopyPrettyValueCommand(this);
            this.CopyEscapedValueCommand = new CopyEscapedValueCommand(this);
            this.TreatAsJsonCommand      = new TreatAsJsonCommand(tree, this);
            this.TreatAsTextCommand      = new TreatAsTextCommand(tree, this);
        }
Beispiel #4
0
 public static ObservableCollection <TreeViewData> CreateCollection(CustomTreeView tree, RootObject rootObject)
 {
     return(new ObservableCollection <TreeViewData>(CreateList(tree, rootObject)));
 }