Пример #1
0
 private void explorerBrowser1_NavigationComplete(object sender, NavigationCompleteEventArgs e)
 {
     if (textBoxPath.Text != e.NewLocation.ParsingName)
     {
         textBoxPath.Text = e.NewLocation.ParsingName;
     }
 }
Пример #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);
            }
        }
 void Explorer_NavigationComplete(object sender, NavigationCompleteEventArgs e)
 {
     if (e.NewLocation.ParsingName == archive.ParsingName)
     {
         btnUpLevel.IsEnabled = false;
     }
     else
     {
         btnUpLevel.IsEnabled = true;
     }
     leftNavBut.IsEnabled = Explorer.NavigationLog.CanNavigateBackward;
     rightNavBut.IsEnabled = Explorer.NavigationLog.CanNavigateForward;
     //throw new NotImplementedException();
 }
Пример #4
0
        void ExplorerBrowserControl_NavigationComplete(object sender, NavigationCompleteEventArgs e)
        {
            try
            {
            //    this.Title = "Better Explorer - " + e.NewLocation.GetDisplayName(DisplayNameType.Default);



                Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)(() =>
                                    {
            //                            ConstructMoveToCopyToMenu();
            //                            if (e.NewLocation.IsFileSystemObject || e.NewLocation.IsNetDrive || e.NewLocation.ParsingName.StartsWith(@"\\"))
            //                            {

            //                                try
            //                                {
            //                                    fsw_AC = new FileSystemWatcher(e.NewLocation.ParsingName);
            //                                    fsw_AC.EnableRaisingEvents = true;
            //                                    fsw_AC.Created += new FileSystemEventHandler(fsw_AC_Created);
            //                                    fsw_AC.Deleted += new FileSystemEventHandler(fsw_AC_Deleted);
            //                                }
            //                                catch
            //                                {

            //                                }
            //                            }

            //                            if (e.NewLocation.IsFileSystemObject)
	           //                         {
		          //                          btnSizeChart.IsEnabled = true;
	           //                         }
            //                            else
	           //                         {
            //                                btnSizeChart.IsEnabled = false;
	           //                         }
            //                            

            //                            btnAutosizeColls.IsEnabled =
            //                                Explorer.ContentOptions.ViewMode == ExplorerBrowserViewMode.Details ?
            //                                  true : false;

            //                            this.breadcrumbBarControl1.LoadDirectory(e.NewLocation);
            //                            this.breadcrumbBarControl1.LastPath = e.NewLocation.ParsingName;
            //                            //}));
                                        bool IsChanged = (Explorer.GetSelectedItemsCount() > 0);
                                        bool isFuncAvail;
                                        if (Explorer.SelectedItems.Count == 1)
                                        {
                                            isFuncAvail = (Explorer.SelectedItems[0].IsFileSystemObject) ||
                                                Explorer.NavigationLog.CurrentLocation.ParsingName ==
                                                  KnownFolders.Libraries.ParsingName;
                                        }
                                        else
                                        {
                                            if (!(Explorer.NavigationLog.CurrentLocation.IsFolder && !Explorer.NavigationLog.CurrentLocation.IsDrive &&
                                                !Explorer.NavigationLog.CurrentLocation.IsSearchFolder))
                                                ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                            isFuncAvail = true;
                                        }
                                        btnCopy.IsEnabled = IsChanged;
                                        //btnPathCopy.IsEnabled = IsChanged;
                                        btnCut.IsEnabled = IsChanged;
                                        btnRename.IsEnabled = IsChanged;
                                        btnDelete.IsEnabled = IsChanged && isFuncAvail;
                                        btnCopyto.IsEnabled = IsChanged;
                                        btnMoveto.IsEnabled = IsChanged;
                                        btnSelNone.IsEnabled = IsChanged;
                                        btnUpLevel.IsEnabled = !(Explorer.NavigationLog.CurrentLocation.Parent == null);

            //                            IntPtr pIDL = IntPtr.Zero;

            //                            try
            //                            {
            //                                uint iAttribute;
            //                                SHParseDisplayName(Explorer.NavigationLog.CurrentLocation.ParsingName,
            //                                    IntPtr.Zero, out pIDL, (uint)0, out iAttribute);

            //                                WindowsAPI.SHFILEINFO sfi = new WindowsAPI.SHFILEINFO();
            //                                IntPtr Res = IntPtr.Zero;
            //                                if (pIDL != IntPtr.Zero)
            //                                {
            //                                    if (!Explorer.NavigationLog.CurrentLocation.IsFileSystemObject)
            //                                    {
            //                                        Res = WindowsAPI.SHGetFileInfo(pIDL, 0, ref sfi, (uint)Marshal.SizeOf(sfi), WindowsAPI.SHGFI.IconLocation | WindowsAPI.SHGFI.SmallIcon | WindowsAPI.SHGFI.PIDL);
            //                                    }

            //                                }

            //                                if (Explorer.NavigationLog.CurrentLocation.IsFileSystemObject)
            //                                {
            //                                    WindowsAPI.SHGetFileInfo(Explorer.NavigationLog.CurrentLocation.ParsingName, 0, ref sfi, (uint)Marshal.SizeOf(sfi), (uint)WindowsAPI.SHGFI.IconLocation | (uint)WindowsAPI.SHGFI.SmallIcon);

            //                                }
            //                                JumpTask JTask = new JumpTask();
            //                                JTask.ApplicationPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
            //                                JTask.Arguments = "\"" + Explorer.NavigationLog.CurrentLocation.ParsingName + "\"";
            //                                JTask.Title = Explorer.NavigationLog.CurrentLocation.GetDisplayName(DisplayNameType.Default);
            //                                JTask.IconResourcePath = sfi.szDisplayName;
            //                                JTask.IconResourceIndex = sfi.iIcon;
            //                                JumpList.AddToRecentCategory(JTask);
            //                                AppJL.Apply();

            //                            }
            //                            finally
            //                            {

            //                                if (pIDL != IntPtr.Zero)
            //                                    Marshal.FreeCoTaskMem(pIDL);
            //                            }

            //                            try
            //                            {

            //                                //CloseableTabItem it = new CloseableTabItem();
            //                                //CreateTabbarRKMenu(it);
            //                                Explorer.NavigationLog.CurrentLocation.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
            //                                Explorer.NavigationLog.CurrentLocation.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
            //                                (tabControl1.Items[CurrentTabIndex] as CloseableTabItem).Header = Explorer.NavigationLog.CurrentLocation.GetDisplayName(DisplayNameType.Default);
            //                                (tabControl1.Items[CurrentTabIndex] as CloseableTabItem).TabIcon = Explorer.NavigationLog.CurrentLocation.Thumbnail.BitmapSource;
            //                                (tabControl1.Items[CurrentTabIndex] as CloseableTabItem).Path = Explorer.NavigationLog.CurrentLocation;
            //                                if (!isGoingBackOrForward)
            //                                {
            //                                    (tabControl1.Items[CurrentTabIndex] as CloseableTabItem).log.CurrentLocation = Explorer.NavigationLog.CurrentLocation;
            //                                }

            //                                isGoingBackOrForward = false;

            //                                leftNavBut.IsEnabled = (tabControl1.Items[CurrentTabIndex] as CloseableTabItem).log.CanNavigateBackwards;
            //                                rightNavBut.IsEnabled = (tabControl1.Items[CurrentTabIndex] as CloseableTabItem).log.CanNavigateForwards;

            //                                //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).DragEnter += new DragEventHandler(newt_DragEnter);
            //                                //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).DragLeave += new DragEventHandler(newt_DragLeave);
            //                                //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).DragOver += new DragEventHandler(newt_DragOver);
            //                                //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).Drop += new DragEventHandler(newt_Drop);
            //                                //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).AllowDrop = true;
            //                                //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).Index = CurrentTabIndex;
            //                                //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).CloseTab += new RoutedEventHandler(cti_CloseTab);
            //                                //tabControl1.Items[CurrentTabIndex] = it;
            //                                tabControl1.SelectedIndex = CurrentTabIndex;


            //                            }
            //                            catch (Exception)
            //                            {

            //                            }
            //                            bool isinLibraries = false;
            //                            if (Explorer.NavigationLog.CurrentLocation.Parent != null)
            //                            {
            //                                if (Explorer.NavigationLog.CurrentLocation.Parent.ParsingName ==
            //                                      KnownFolders.Libraries.ParsingName)
            //                                {
            //                                    isinLibraries = true;
            //                                }
            //                                else
            //                                {
            //                                    isinLibraries = false;
            //                                }
            //                            }

            //                            btnCreateFolder.IsEnabled = Explorer.NavigationLog.CurrentLocation.IsFileSystemObject ||
            //                                (Explorer.NavigationLog.CurrentLocation.ParsingName == KnownFolders.Libraries.ParsingName) ||
            //                                (isinLibraries);
            //                            if (Explorer.NavigationLog.CurrentLocation.ParsingName == KnownFolders.Libraries.ParsingName)
            //                            {
            //                                btnCreateFolder.Header = FindResource("btnNewLibraryCP");  //"New Library";
            //                                stNewFolder.Title = FindResource("btnNewLibraryCP").ToString();//"New Library";
            //                                stNewFolder.Text = "Creates a new library in the current folder.";
            //                                stNewFolder.Image = new BitmapImage(new Uri(@"/BetterExplorer;component/Images/newlib32.png", UriKind.Relative));
            //                                btnCreateFolder.LargeIcon = @"..\Images\newlib32.png";
            //                                btnCreateFolder.Icon = @"..\Images\newlib16.png";
            //                            }
            //                            else
            //                            {
            //                                btnCreateFolder.Header = FindResource("btnNewFolderCP");//"New Folder";
            //                                stNewFolder.Title = FindResource("btnNewFolderCP").ToString(); //"New Folder";
            //                                stNewFolder.Text = "Creates a new folder in the current folder";
            //                                stNewFolder.Image = new BitmapImage(new Uri(@"/BetterExplorer;component/Images/folder_new32.png", UriKind.Relative));
            //                                btnCreateFolder.LargeIcon = @"..\Images\folder_new32.png";
            //                                btnCreateFolder.Icon = @"..\Images\folder_new16.png";
            //                            }
            //                            if (Explorer.NavigationLog.CurrentLocation.IsFolder && !Explorer.NavigationLog.CurrentLocation.IsDrive &&
            //                                !Explorer.NavigationLog.CurrentLocation.IsSearchFolder)
            //                            {
            //                                ctgFolderTools.Visibility = Visibility.Visible;
            //                            }

            //                            if (Explorer.NavigationLog.CurrentLocation.ParsingName.Contains(KnownFolders.Libraries.ParsingName) &&
            //                                Explorer.NavigationLog.CurrentLocation.ParsingName != KnownFolders.Libraries.ParsingName)
            //                            {
            //                                ctgLibraries.Visibility = System.Windows.Visibility.Visible;
            //                                ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
            //                                ctgImage.Visibility = System.Windows.Visibility.Collapsed;
            //                                ctgArchive.Visibility = System.Windows.Visibility.Collapsed;
            //                                ctgExe.Visibility = System.Windows.Visibility.Collapsed;
            //                                inLibrary = true;

            //                                //MessageBox.Show("In Library");
            //                                try
            //                                {
            //                                    ShellLibrary lib =
            //                                        ShellLibrary.Load(Explorer.NavigationLog.CurrentLocation.GetDisplayName(DisplayNameType.Default), false);
            //                                    IsFromSelectionOrNavigation = true;
            //                                    chkPinNav.IsChecked = lib.IsPinnedToNavigationPane;
            //                                    IsFromSelectionOrNavigation = false;
            //                                    foreach (ShellObject item in lib)
            //                                    {
            //                                        MenuItem miItem = new MenuItem();
            //                                        miItem.Header = item.GetDisplayName(DisplayNameType.Default);
            //                                        miItem.Tag = item;
            //                                        item.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
            //                                        item.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
            //                                        miItem.Icon = item.Thumbnail.BitmapSource;
            //                                        miItem.GroupName = "GRDS1";
            //                                        miItem.IsCheckable = true;
            //                                        miItem.IsChecked = (item.ParsingName == lib.DefaultSaveFolder);
            //                                        miItem.Click += new RoutedEventHandler(miItem_Click);
            //                                        btnDefSave.Items.Add(miItem);
            //                                    }

            //                                    btnDefSave.IsEnabled = !(lib.Count == 0);
            //                                    lib.Close();
            //                                }
            //                                catch
            //                                {

            //                                }
            //                            }
            //                            else
            //                            {
            //                                if (!Explorer.NavigationLog.CurrentLocation.ParsingName.ToLowerInvariant().EndsWith("library-ms"))
            //                                {
            //                                    btnDefSave.Items.Clear();
            //                                    ctgLibraries.Visibility = System.Windows.Visibility.Collapsed;
            //                                    inLibrary = false;
            //                                }
            //                                //MessageBox.Show("Not in Library");
            //                            }
            //                            if (Explorer.NavigationLog.CurrentLocation.IsDrive)
            //                            {
            //                                ctgDrive.Visibility = System.Windows.Visibility.Visible;
            //                                inDrive = true;
            //                                //MessageBox.Show("In Drive");
            //                            }
            //                            else
            //                            {
            //                                ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
            //                                inDrive = false;
            //                                //MessageBox.Show("Not In Drive");
            //                            }
            //                            if (isinLibraries)
            //                            {
            //                                ctgFolderTools.Visibility = Visibility.Collapsed;
            //                            }

                                    }
                                ));

                GC.WaitForPendingFinalizers();
                GC.Collect();
            }
            catch (Exception exe)
            {
            //    ShellObject ne = e.NewLocation;
            //    bool isinLibraries = false;
            //    bool itisLibraries = false;

            //    if (ne.Parent.ParsingName == KnownFolders.Libraries.ParsingName)
            //    {
            //        isinLibraries = true;
            //    }
            //    else
            //    {
            //        isinLibraries = false;
            //    }

            //    if (ne.ParsingName == KnownFolders.Libraries.ParsingName)
            //    {
            //        itisLibraries = true;
            //    }
            //    else
            //    {
            //        itisLibraries = false;
            //    }

            //    //if (MessageBox.Show("An error occurred while loading a folder. Please report this issue at http://bexplorer.codeplex.com/. \r\n\r\nHere is some information about the folder being loaded:\r\n\r\nName: " + ne.GetDisplayName(DisplayNameType.Default) + "\r\nLocation: " + ne.ParsingName +
            //    //    "\r\n\r\nFolder, Drive, or Library: " + GetYesNoFromBoolean(ne.IsFolder) + "\r\nDrive: " + GetYesNoFromBoolean(ne.IsDrive) + "\r\nNetwork Drive: " + GetYesNoFromBoolean(ne.IsNetDrive) + "\r\nRemovable: " + GetYesNoFromBoolean(ne.IsRemovable) +
            //    //    "\r\nSearch Folder: " + GetYesNoFromBoolean(ne.IsSearchFolder) + "\r\nShared: " + GetYesNoFromBoolean(ne.IsShared) + "\r\nShortcut: " + GetYesNoFromBoolean(ne.IsLink) + "\r\nLibrary: " + GetYesNoFromBoolean(isinLibraries) + "\r\nLibraries Folder: " + GetYesNoFromBoolean(itisLibraries) +
            //    //    "\r\n\r\n Would you like to see additional information? Click No to try continuing the program.", "Error Occurred on Completing Navigation", MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.Yes)
            //    //{
            //    //    MessageBox.Show("An error occurred while loading a folder. Please report this issue at http://bexplorer.codeplex.com/. \r\n\r\nHere is additional information about the error: \r\n\r\n" + exe.Message + "\r\n\r\n" + exe.ToString(), "Additional Error Data", MessageBoxButton.OK, MessageBoxImage.Error);
            //    //}
            }

            Explorer.ExplorerSetFocus();
        }
Пример #5
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 explorerBrowser_NavigationComplete(object sender, NavigationCompleteEventArgs args)
 {
     // This event is BeginInvoked to decouple the ExplorerBrowser UI from this UI
     BeginInvoke(new MethodInvoker(delegate()
     {
         // update event history text box
         string location = (args.NewLocation == null) ? "(unknown)" : args.NewLocation.Name;
         this.eventHistoryTextBox.Text =
             this.eventHistoryTextBox.Text +
             "Navigation completed. New Location = " + location + "\n";
     }));
 }
Пример #7
0
        void explorerBrowser_NavigationComplete(object sender, NavigationCompleteEventArgs args)
        {
            // This event is BeginInvoked to decouple the explorerBrowser UI from this UI
            this.BeginInvoke(new MethodInvoker(delegate()
            {
                // update event history
                if (args.NewLocation == null)
                {
                    logError("Error retrieving navigation location.");
                    return;
                }
                else
                    logInfo("Navigation completed. New Location = " + args.NewLocation.Name);

                if (args.NewLocation != null)
                    this.pathEdit.Text = new DataComboBox.Element() { Text = args.NewLocation.ParsingName.StartsWith("::{") ? args.NewLocation.Name : args.NewLocation.ParsingName, Value = args.NewLocation.ParsingName };
            }));
        }
 private void browser_NavigationComplete(object sender, NavigationCompleteEventArgs e)
 {
     OnPropertyChanged("CurrentDirectory");
     OnPropertyChanged("CurrentFileName");
     updateButtonStatus();
 }