BetterExplorer.MainWindow.ShellListView_Navigated C# (CSharp) 메소드

ShellListView_Navigated() 개인적인 메소드

private ShellListView_Navigated ( object sender, NavigatedEventArgs e ) : void
sender object
e NavigatedEventArgs
리턴 void
    void ShellListView_Navigated(object sender, NavigatedEventArgs e) {
      this._ProgressTimer.Stop();
      this.btnCancelNavigation.Visibility = Visibility.Collapsed;
      this.btnGoNavigation.Visibility = Visibility.Visible;
      SetupUIOnSelectOrNavigate();

      Dispatcher.BeginInvoke(DispatcherPriority.Background, (ThreadStart)(() => {
        SetupColumnsButton();
        SetSortingAndGroupingButtons();

        if (!tcMain.isGoingBackOrForward) {
          var Current = (tcMain.SelectedItem as Wpf.Controls.TabItem).log;
          Current.ClearForwardItems();
          if (Current.CurrentLocation != e.Folder) Current.CurrentLocation = e.Folder;
        }

        tcMain.isGoingBackOrForward = false;
        SetupUIonNavComplete(e);

        if (this.IsConsoleShown)
          ctrlConsole.ChangeFolder(e.Folder.ParsingName, e.Folder.IsFileSystem);
      }));

      Dispatcher.BeginInvoke(DispatcherPriority.Background, (ThreadStart)(() => {
        ConstructMoveToCopyToMenu();
        SetUpJumpListOnNavComplete();
        SetUpButtonVisibilityOnNavComplete(SetUpNewFolderButtons());
      }));

      if (this.IsInfoPaneEnabled) {
        Task.Run(() => {
          this.DetailsPanel.FillPreviewPane(this._ShellListView);
        });
      }

      Dispatcher.Invoke(DispatcherPriority.Render, (Action)(() => {
        this._ShellListView.Focus(false, true);
        var selectedItem = this.tcMain.SelectedItem as Wpf.Controls.TabItem;
        if (selectedItem == null) {
          this.tcMain.SelectedItem = this.tcMain.Items.OfType<Wpf.Controls.TabItem>().Last();
          selectedItem = this.tcMain.SelectedItem as Wpf.Controls.TabItem;
        }
        var oldCurrentItem = selectedItem.ShellObject;
        var curentFolder = this._ShellListView.CurrentFolder.Clone();
        selectedItem.Header = this._ShellListView.CurrentFolder.DisplayName;
        selectedItem.Icon = curentFolder.ThumbnailSource(16, ShellThumbnailFormatOption.IconOnly, ShellThumbnailRetrievalOption.Default);
        selectedItem.ShellObject = this._ShellListView.CurrentFolder;
        if (selectedItem != null) {
          var selectedPaths = selectedItem.SelectedItems;
          if (selectedPaths?.Count > 0) {
            foreach (var path in selectedPaths.ToArray()) {
              var sho = this._ShellListView.Items.FirstOrDefault(w => w.ParsingName == path);
              if (sho != null) {
                var index = sho.ItemIndex;
                this._ShellListView.SelectItemByIndex(index, path.Equals(selectedPaths.Last(), StringComparison.InvariantCultureIgnoreCase) || this.IsNeedEnsureVisible);
                this.IsNeedEnsureVisible = false;
                selectedPaths.Remove(path);
              }
            }
          } else {
            var realItem = this._ShellListView.Items.ToArray().FirstOrDefault(w => w.GetUniqueID() == oldCurrentItem.GetUniqueID());
            if (realItem != null) {
              this._ShellListView.SelectItems(new[] { realItem });
            } else {
              if (!curentFolder.ParsingName.Contains(oldCurrentItem.ParsingName)) {
                var parents = new List<IListItemEx>();
                var parent = oldCurrentItem.Parent;
                while (parent != null) {
                  parents.Add(parent);
                  realItem = this._ShellListView.Items.ToArray().FirstOrDefault(w => w.GetUniqueID() == parent.GetUniqueID());
                  if (realItem != null) {
                    this._ShellListView.SelectItems(new[] { realItem });
                    break;
                  }
                  parent = parent.Parent;
                }
              }
            }

            //this._ShellListView.ScrollToTop();
          }
        }
        oldCurrentItem.Dispose();
        curentFolder.Dispose();
      }));

      ////This initially setup the statusbar after program opens
      Dispatcher.BeginInvoke(DispatcherPriority.Background, (ThreadStart)(() => {
        this.SetUpStatusBarOnSelectOrNavigate(_ShellListView.SelectedItems == null ? 0 : _ShellListView.GetSelectedCount());
      }));

      //Dispatcher.BeginInvoke(DispatcherPriority.Background, (ThreadStart) (() => {
      //    Thread.Sleep(1500);
      if (this.bcbc.ProgressValue > 2)
        this.bcbc.SetProgressValue(this.bcbc.ProgressMaximum, TimeSpan.FromMilliseconds(750));
      else
        this.bcbc.SetProgressValue(0, TimeSpan.FromSeconds(0));
      this.bcbc.ProgressMaximum = 100;
      //this.bcbc.SetProgressValue(0, TimeSpan.FromSeconds(0));
      //}));


    }
MainWindow