private void UpdateVisgroups(bool retainCheckStates) { _populating = true; var visgroups = Document.Map.Visgroups.Select(x => x.Clone()).ToList(); Action <Visgroup> setVisible = null; setVisible = x => { x.Visible = false; x.Children.ForEach(y => setVisible(y)); }; visgroups.ForEach(x => setVisible(x)); Dictionary <int, CheckState> states; if (retainCheckStates) { states = VisgroupPanel.GetAllCheckStates(); } else { states = Objects.SelectMany(x => x.Visgroups) .GroupBy(x => x) .Select(x => new { ID = x.Key, Count = x.Count() }) .Where(g => g.Count > 0) .ToDictionary(g => g.ID, g => g.Count == Objects.Count ? CheckState.Checked : CheckState.Indeterminate); } VisgroupPanel.Update(visgroups); foreach (var kv in states) { VisgroupPanel.SetCheckState(kv.Key, kv.Value); } VisgroupPanel.ExpandAllNodes(); _populating = false; }
private void VisgroupsChanged() { VisgroupPanel.Update(DocumentManager.CurrentDocument); }
private void DocumentAllClosed() { VisgroupPanel.Update(DocumentManager.CurrentDocument); }