Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
		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;
		}
Ejemplo n.º 5
0
		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;
		}
Ejemplo n.º 6
0
		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);
			}
		}
Ejemplo n.º 7
0
		private void OnNavigationFailed(object sender, NavigationFailedEventArgs args) {
			pendingNavigation = null;
		}
Ejemplo n.º 8
0
 private void OnNavigationFailed(object sender, NavigationFailedEventArgs args)
 {
     pendingNavigation = null;
 }