Пример #1
0
            public override System.Collections.IEnumerable GetChildren(TreePath treePath)
            {
                if (this._buffer != null)
                {
                    foreach (UnlockListAction.Watch watch in _buffer)
                    {
                        WatchNode node = new WatchNode(watch.VarName, watch.VarValue);
                        node.Id = watch.Index;
                        node.ParentId = watch.ParentIndex;

                        this._watches[watch.Index] = node;

                        WatchNode parent = null;
                        _watches.TryGetValue(watch.ParentIndex, out parent);

                        if (parent != null)
                        {
                            parent.Nodes.Add(node);
                        }
                        else
                        {
                            this._model.Nodes.Add(node);
                        }
                    }

                    this._buffer = null;

                    this._model.NodesChanged += new EventHandler<TreeModelEventArgs>(TreeNodesChanged);
                    this._model.NodesInserted += new EventHandler<TreeModelEventArgs>(TreeNodesInserted);
                    this._model.NodesRemoved += new EventHandler<TreeModelEventArgs>(TreeNodesRemoved);
                    this._model.StructureChanged += new EventHandler<TreePathEventArgs>(TreeStructureChanged);
                }

                if (treePath.FullPath.Length <= 0)
                {
                    foreach (Node child in _model.Nodes)
                    {
                        yield return child;
                    }
                }
                else
                {
                    Node node = treePath.LastNode as Node;

                    if (node != null)
                    {
                        foreach (Node child in node.Nodes)
                        {
                            yield return child;
                        }
                    }
                }
            }
Пример #2
0
 public WatchTreeModel(UnlockListAction.WatchList buffer)
 {
     this._model = new TreeModel();
     this._buffer = buffer != null ? buffer : new UnlockListAction.WatchList();
 }