private void LoadTreeSection(TreeNode node) { string nodeIndex = node.Name; if (nodeIndex.Substring(0, 1) != "_") { Energosphere.Point point = aiis.GetPoint(int.Parse(nodeIndex)); if (point == null) { return; } aiis.LoadSubtree(point); node.Expand(); node.EnsureVisible(); } }
private void TreePoints_BeforeExpand(object sender, TreeViewCancelEventArgs e) { int id; if (e.Node.Name.Substring(0, 1) != "_") { id = int.Parse(e.Node.Name); Energosphere.Point current = aiis.GetPoint(id); if (current == null) { throw new PointNotFoundException("В загруженной расчетной схеме нет точки с ID_Point = " + id); } if (!current.Loaded) { FillTree(e.Node, current.Children); } } }
private void TreePoints_AfterCheck(object sender, TreeViewEventArgs e) { if (processChecks) { Parameter current = null; Energosphere.Point point = null; this.Cursor = Cursors.WaitCursor; if (e.Node.Name.Substring(0, 1) != "_") { point = aiis.AllPoints.FirstOrDefault(p => p.ID == int.Parse(e.Node.Name)); if (point == null) { point = aiis.LoadPoint(int.Parse(e.Node.Name)); } } else { current = aiis.AllParameters.FirstOrDefault(p => p.Id.ToString() == e.Node.Name.Replace("_", string.Empty)); if (current == null) { current = aiis.LoadParameter(e.Node.Name.Replace("_", string.Empty)); } point = current.ParentPoint; } if (e.Node.Checked) { if ((point.Type == PointTypes.Feeder || point.Type == PointTypes.FeederWithBypass) && !selected.Contains(current) && current != null) { selected.Add(current); } } else if (selected.Count > 0) { selected.Remove(selected.FirstOrDefault(p => p.Id.ToString() == e.Node.Name.Replace("_", string.Empty))); } CheckChildren(e.Node, e.Node.Checked); processChecks = true; CountChecked(); ClearCheck(); this.Cursor = Cursors.Default; } }