void StoreStates(TreeListNode senderNode) { try { BaseTreeListTag senderNodeTag = senderNode.Tag as BaseTreeListTag; //not that using string senderNodeID = (senderNodeTag as BaseTreeListTag).GetDefaultID() //is not a good idea, because it slows the process down by many catches if the data-row stored in the tag does not exist any more if (senderNode.Expanded) { _expandedNodesIDs.Add(senderNodeTag.GetDefaultID()); } if (senderNode.Selected) { _selectedNodesIDs.Add(senderNodeTag.GetDefaultID()); } if (senderNode.Visible == false) { _hiddenNodesIDs.Add(senderNodeTag.GetDefaultID()); } if (senderNode.Focused) { _focusedNodeID = senderNodeTag.GetDefaultID(); _focusedColumnIndex = senderNode.TreeList.Columns.IndexOf(senderNode.TreeList.FocusedColumn); //also store the focused column _focusedNodeID_alternative = GetFocusedNodeID_alternative(senderNode); } } catch (Exception e) { //do not jeopardise tree-list building, because node state cannot be restored (e.g. nodes point at deleted data-rows) Tools.UserInfoHandler.RecordIgnoredException("StoreRestoreNodeStates.StoreStates", e); } }
private static void AddHiddenNode(ref List <string> hiddenNodes, TreeListNode node) { if (node.Visible || node.Tag == null) { return; } BaseTreeListTag tag = node.Tag as BaseTreeListTag; if (tag == null) { return; } hiddenNodes.AddUnique(tag.GetDefaultID(), true); }
private static void SetHiddenNode(List <string> hiddenNodes, TreeListNode node) { if (node.Tag == null) { return; } BaseTreeListTag tag = node.Tag as BaseTreeListTag; if (tag == null) { return; } if (hiddenNodes.Contains(tag.GetDefaultID(), true)) { node.Visible = false; // this assumes that ids do not change (which should actually be the case between country-close and reopen, and if not - not much harm done) } }
internal override bool Execute(TreeListNode senderNode) { BaseTreeListTag tag = senderNode.Tag as BaseTreeListTag; return(_nodeIDs.Contains(tag.GetDefaultID())); }