private void ClearAll() { if (VariablesTreeRootIndex() != -1) { VariablesNode = Roots[VariablesTreeRootIndex()]; } Roots.Clear(); _backUpRoots.Clear(); if (VariablesNode != null) { Roots.Add(VariablesNode); _backUpRoots.Add(VariablesNode); } _categories?.Clear(); }
private void Add_Click(object sender, RoutedEventArgs e) { var item = new VariableItem(""); _variables.Add(item); _backupVariables.Add(item); var i = Host.NodesTree.VariablesTreeRootIndex(); var getItem = new NodeItem("", "Get " + item.Name, new Get(Host, item, false)); item.Gets--; var setItem = new NodeItem("", "Set " + item.Name, new Set(Host, item, false)); item.Sets--; item.NodesTreeItems.Add(getItem); item.NodesTreeItems.Add(setItem); if (i > -1) { Host.NodesTree.Roots[i].Nodes.Add(getItem); Host.NodesTree.Roots[i].Nodes.Add(setItem); } _variableName.Focus(); }
private int GetTotalNodes(NodeItem nodes) { return(nodes.NodesCount + nodes.Nodes.Sum(GetTotalNodes)); }