コード例 #1
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);
            }
        }
コード例 #2
0
ファイル: NavigationLog.cs プロジェクト: GodLesZ/svn-dump
		/// <summary>
		/// Clears the contents of the navigation log.
		/// </summary>
		public void ClearLog() {
			// nothing to do
			if (_locations.Count == 0) { return; }

			bool oldCanNavigateBackward = CanNavigateBackward;
			bool oldCanNavigateForward = CanNavigateForward;

			_locations.Clear();
			this.currentLocationIndex = -1;

			NavigationLogEventArgs args = new NavigationLogEventArgs();
			args.LocationsChanged = true;
			args.CanNavigateBackwardChanged = (oldCanNavigateBackward != CanNavigateBackward);
			args.CanNavigateForwardChanged = (oldCanNavigateForward != CanNavigateForward);
			if (NavigationLogChanged != null) {
				NavigationLogChanged(this, args);
			}
		}
コード例 #3
0
        /// <summary>
        /// Clears the contents of the navigation log.
        /// </summary>
        public void ClearLog()
        {
            // nothing to do
            if (_locations.Count == 0)
            {
                return;
            }

            bool oldCanNavigateBackward = CanNavigateBackward;
            bool oldCanNavigateForward  = CanNavigateForward;

            _locations.Clear();
            this.currentLocationIndex = -1;

            NavigationLogEventArgs args = new NavigationLogEventArgs();

            args.LocationsChanged           = true;
            args.CanNavigateBackwardChanged = (oldCanNavigateBackward != CanNavigateBackward);
            args.CanNavigateForwardChanged  = (oldCanNavigateForward != CanNavigateForward);
            if (NavigationLogChanged != null)
            {
                NavigationLogChanged(this, args);
            }
        }
コード例 #4
0
ファイル: NavigationLog.cs プロジェクト: GodLesZ/svn-dump
		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);
			}
		}