/// <summary>Clears the contents of the navigation log.</summary>
        public void ClearLog()
        {
            // nothing to do
            if (_locations.Count == 0)
            {
                return;
            }

            var oldCanNavigateBackward = CanNavigateBackward;
            var oldCanNavigateForward  = CanNavigateForward;

            _locations.Clear();
            currentLocationIndex = -1;

            var args = new NavigationLogEventArgs
            {
                LocationsChanged           = true,
                CanNavigateBackwardChanged = (oldCanNavigateBackward != CanNavigateBackward),
                CanNavigateForwardChanged  = (oldCanNavigateForward != CanNavigateForward)
            };

            if (NavigationLogChanged != null)
            {
                NavigationLogChanged(this, args);
            }
        }
示例#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);
            }
        }
示例#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
        /// <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();
            currentLocationIndex = -1;

            var args = new NavigationLogEventArgs
            {
                LocationsChanged           = true,
                CanNavigateBackwardChanged = oldCanNavigateBackward != CanNavigateBackward,
                CanNavigateForwardChanged  = oldCanNavigateForward != CanNavigateForward
            };

            NavigationLogChanged?.Invoke(this, args);
        }
示例#5
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);
            }
        }
 void gli_Click(object sender, NavigationLogEventArgs e)
 {
     ReOpenTab(e.NavigationLog);
     reopenabletabs.Remove((sender as UndoCloseGalleryItem).nav);
     if (reopenabletabs.Count == 0)
     {
         btnUndoClose.IsEnabled = false;
     }
 }
 /// <summary>
 /// Synchronize NavigationLog collection to dependency collection
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 void NavigationLogChanged( object sender, NavigationLogEventArgs args )
 {
     navigationLog.Clear( );
     foreach( ShellObject obj in ExplorerBrowserControl.NavigationLog.Locations )
     {
         navigationLog.Add( obj );
     }
 }
示例#8
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);
            }
        }
        void NavigationLog_NavigationLogChanged(object sender, NavigationLogEventArgs args)
        {
            // This event is BeginInvoked to decouple the ExplorerBrowser UI from this UI
            BeginInvoke(new MethodInvoker(delegate()
            {
                // calculate button states
                if (args.CanNavigateBackwardChanged)
                {
                    this.backButton.Enabled = explorerBrowser.NavigationLog.CanNavigateBackward;
                }
                if (args.CanNavigateForwardChanged)
                {
                    this.forwardButton.Enabled = explorerBrowser.NavigationLog.CanNavigateForward;
                }

                // update history combo box
                if (args.LocationsChanged)
                {
                    this.navigationHistoryCombo.Items.Clear();
                    foreach (ShellObject shobj in this.explorerBrowser.NavigationLog.Locations)
                    {
                        this.navigationHistoryCombo.Items.Add(shobj.Name);
                    }
                }
                if (this.explorerBrowser.NavigationLog.CurrentLocationIndex == -1)
                    this.navigationHistoryCombo.Text = "";
                else
                    this.navigationHistoryCombo.SelectedIndex = this.explorerBrowser.NavigationLog.CurrentLocationIndex;
            }));
        }
示例#10
0
        void NavigationLog_NavigationLogChanged(object sender, NavigationLogEventArgs args)
        {
            // calculate button states
            if (args.CanNavigateBackwardChanged)
            {
                this.explorerNavigationButtons1.HasLeftHistroy = this.explorerBrowser.NavigationLog.CanNavigateBackward;
            }
            if (args.CanNavigateForwardChanged)
            {
                this.explorerNavigationButtons1.HasRightHistroy = this.explorerBrowser.NavigationLog.CanNavigateForward;
            }

            // This event is BeginInvoked to decouple the explorerBrowser UI from this UI
            this.BeginInvoke(new MethodInvoker(delegate()
            {
                // update history combo box
                if (args.LocationsChanged)
                {
                    this.contextMenu.Items.Clear();
                    foreach (ShellObject shobj in this.explorerBrowser.NavigationLog.Locations)
                    {
                        logInfo("Navigation: " + shobj.Name);
                        this.contextMenu.Items.Add(shobj.Name);
                    }
                }

                for (int i = 0; i < this.contextMenu.Items.Count; i++ )
                    this.contextMenu.Items[i].Image = null;

                if (this.explorerBrowser.NavigationLog.CurrentLocationIndex != -1)
                    this.contextMenu.Items[this.explorerBrowser.NavigationLog.CurrentLocationIndex].Image =
                        Resources._checked;
            }));
        }