/// <summary> /// Navigates backward. /// </summary> public void NavigateBackward() { // Check if navigation is unlocked if (_navigationUnlocked && _navigationUndo.Count > 0) { // Pop node ContentTreeNode node = _navigationUndo.Pop(); // Lock navigation _navigationUnlocked = false; // Add to Redo list _navigationRedo.Push(SelectedNode); // Select node RefreshView(node); _tree.Select(node); node.ExpandAllParents(); // Set valid sizes for stacks //RedoList.SetSize(32); //UndoList.SetSize(32); // Update search UpdateItemsSearch(); // Unlock navigation _navigationUnlocked = true; // Update UI UpdateUI(); _view.SelectFirstItem(); } }
private void Navigate(ContentTreeNode source, ContentTreeNode target) { if (target == null) { target = _root; } // Check if can do this action if (_navigationUnlocked && source != target) { // Lock navigation _navigationUnlocked = false; // Check if already added to the Undo on the top if (source != null && (_navigationUndo.Count == 0 || _navigationUndo.Peek() != source)) { // Add to Undo list _navigationUndo.Push(source); } // Show folder contents and select tree node RefreshView(target); _tree.Select(target); target.ExpandAllParents(); // Clear redo list _navigationRedo.Clear(); // Set valid sizes for stacks //RedoList.SetSize(32); //UndoList.SetSize(32); // Update search UpdateItemsSearch(); // Unlock navigation _navigationUnlocked = true; // Update UI UpdateUI(); _view.SelectFirstItem(); } }