public bool NavigateLog(NavigationLogDirection direction) { // determine proper index to navigate to int locationIndex = 0; if (direction == NavigationLogDirection.Backward && CanNavigateBackward) { locationIndex = (currentLocationIndex - 1); } else if (direction == NavigationLogDirection.Forward && CanNavigateForward) { locationIndex = (currentLocationIndex + 1); } else { return(false); } // initiate traversal request ShellObject location = _locations[(int)locationIndex]; pendingNavigation = new PendingNavigation(location, locationIndex); parent.Navigate(location); return(true); }
private void OnNavigationComplete(object sender, NavigationCompleteEventArgs args) { NavigationLogEventArgs eventArgs = new NavigationLogEventArgs(); bool oldCanNavigateBackward = CanNavigateBackward; bool oldCanNavigateForward = CanNavigateForward; if ((pendingNavigation != null)) { // navigation log traversal in progress // determine if new location is the same as the traversal request int result = 0; pendingNavigation.Location.NativeShellItem.Compare( args.NewLocation.NativeShellItem, SICHINTF.SICHINT_ALLFIELDS, out result); bool shellItemsEqual = (result == 0); if (shellItemsEqual == false) { // new location is different than traversal request, // behave is if it never happened! // remove history following currentLocationIndex, append new item if (currentLocationIndex < (_locations.Count - 1)) { _locations.RemoveRange((int)currentLocationIndex + 1, (int)(_locations.Count - (currentLocationIndex + 1))); } _locations.Add(args.NewLocation); currentLocationIndex = (_locations.Count - 1); eventArgs.LocationsChanged = true; } else { // log traversal successful, update index currentLocationIndex = (int)pendingNavigation.Index; eventArgs.LocationsChanged = false; } pendingNavigation = null; } else { // remove history following currentLocationIndex, append new item if (currentLocationIndex < (_locations.Count - 1)) { _locations.RemoveRange((int)currentLocationIndex + 1, (int)(_locations.Count - (currentLocationIndex + 1))); } _locations.Add(args.NewLocation); currentLocationIndex = (_locations.Count - 1); eventArgs.LocationsChanged = true; } // update event args eventArgs.CanNavigateBackwardChanged = (oldCanNavigateBackward != CanNavigateBackward); eventArgs.CanNavigateForwardChanged = (oldCanNavigateForward != CanNavigateForward); if (NavigationLogChanged != null) { NavigationLogChanged(this, eventArgs); } }
public bool NavigateLog(int index) { // can't go anywhere if (index >= _locations.Count || index < 0) { return(false); } // no need to re navigate to the same location if (index == currentLocationIndex) { return(false); } // initiate traversal request ShellObject location = _locations[(int)index]; pendingNavigation = new PendingNavigation(location, index); parent.Navigate(location); return(true); }
internal bool NavigateLog(int index) { // can't go anywhere if (index >= _locations.Count || index < 0) { return false; } // no need to re navigate to the same location if (index == currentLocationIndex) { return false; } // initiate traversal request ShellObject location = _locations[(int)index]; pendingNavigation = new PendingNavigation(location, index); parent.Navigate(location); return true; }
internal bool NavigateLog(NavigationLogDirection direction) { // determine proper index to navigate to int locationIndex = 0; if (direction == NavigationLogDirection.Backward && CanNavigateBackward) { locationIndex = (currentLocationIndex - 1); } else if (direction == NavigationLogDirection.Forward && CanNavigateForward) { locationIndex = (currentLocationIndex + 1); } else { return false; } // initiate traversal request ShellObject location = _locations[(int)locationIndex]; pendingNavigation = new PendingNavigation(location, locationIndex); parent.Navigate(location); return true; }
private void OnNavigationFailed(object sender, NavigationFailedEventArgs args) { pendingNavigation = null; }