private void btnNewItem_Click(object sender, RoutedEventArgs e) {
   var state = new BExplorer.Shell.Interop.Shell32.SHELLSTATE() { fShowAllObjects = 0 };
   BExplorer.Shell.Interop.Shell32.SHGetSetSettings(ref state, BExplorer.Shell.Interop.Shell32.SSF.SSF_SHOWALLOBJECTS, true);
 }
    private void chkHiddenFiles_Unchecked(object sender, RoutedEventArgs e) {
      if (_IsCalledFromLoading) return;
      Dispatcher.BeginInvoke(new Action(
                      delegate () {
                        var state = new BExplorer.Shell.Interop.Shell32.SHELLSTATE() { fShowAllObjects = 0 };
                        BExplorer.Shell.Interop.Shell32.SHGetSetSettings(ref state, BExplorer.Shell.Interop.Shell32.SSF.SSF_SHOWALLOBJECTS, true);
                        _ShellListView.ShowHidden = false;

                        ShellTree.IsShowHiddenItems = false;
                        ShellTree.RefreshContents();
                      }
      ));
    }
 private void chkExtensions_Unchecked(object sender, RoutedEventArgs e) {
   if (_IsCalledFromLoading) return;
   Dispatcher.BeginInvoke(new Action(
                   delegate () {
                     var state = new BExplorer.Shell.Interop.Shell32.SHELLSTATE();
                     state.fShowExtensions = 0;
                     BExplorer.Shell.Interop.Shell32.SHGetSetSettings(ref state, BExplorer.Shell.Interop.Shell32.SSF.SSF_SHOWEXTENSIONS, true);
                     this._ShellListView.IsFileExtensionShown = false;
                     _ShellListView.RefreshContents();
                   }
   ));
 }
    private void Window_Loaded(object sender, RoutedEventArgs e) {
      this._ProgressTimer.Tick += (obj, args) => {
        if (this.bcbc.ProgressValue + 2 == this.bcbc.ProgressMaximum) {
          this.bcbc.ProgressMaximum = this.bcbc.ProgressMaximum + 2;
          this.bcbc.SetProgressValue(this.bcbc.ProgressValue + 2, TimeSpan.FromMilliseconds(0));
        } else {
          this.bcbc.SetProgressValue(this.bcbc.ProgressValue + 2, TimeSpan.FromMilliseconds(450));
        }
      };

      this._ProgressTimer.Stop();
      TheRibbon.UpdateLayout();
      this.grdItemTextColor.ItemsSource = this.LVItemsColorCol;
      _keyjumpTimer.Interval = 1000;
      _keyjumpTimer.Tick += _keyjumpTimer_Tick;
      ShellTreeHost.Child = ShellTree;
      ShellViewHost.Child = _ShellListView;

      ShellTree.ShellListView = _ShellListView;
      this.ctrlConsole.ShellListView = this._ShellListView;
      this.autoUpdater.UpdateAvailable += AutoUpdater_UpdateAvailable;
      this.updateCheckTimer.Interval = 10000;//3600000 * 3;
      this.updateCheckTimer.Tick += new EventHandler(updateCheckTimer_Tick);
      this.updateCheckTimer.Enabled = false;

      UpdateRecycleBinInfos();
      bool exitApp = false;

      try {
        //Sets up FileSystemWatcher for Favorites folder
        var LinksFolderWarcher = new FileSystemWatcher(KnownFolders.Links.ParsingName);
        LinksFolderWarcher.Created += LinksFolderWarcher_Created;
        LinksFolderWarcher.Deleted += LinksFolderWarcher_Deleted;
        LinksFolderWarcher.Renamed += LinksFolderWarcher_Renamed;
        LinksFolderWarcher.EnableRaisingEvents = true;

        //Set up Favorites Menu

        //Task.Run(() => SetUpFavoritesMenu());
        SetUpFavoritesMenu();

        //Load the ShellSettings
        _IsCalledFromLoading = true;
        var statef = new BExplorer.Shell.Interop.Shell32.SHELLSTATE();
        BExplorer.Shell.Interop.Shell32.SHGetSetSettings(ref statef, BExplorer.Shell.Interop.Shell32.SSF.SSF_SHOWALLOBJECTS | BExplorer.Shell.Interop.Shell32.SSF.SSF_SHOWEXTENSIONS, false);
        chkHiddenFiles.IsChecked = statef.fShowAllObjects == 1;
        _ShellListView.ShowHidden = chkHiddenFiles.IsChecked.Value;
        ShellTree.IsShowHiddenItems = chkHiddenFiles.IsChecked.Value;
        chkExtensions.IsChecked = statef.fShowExtensions == 1;
        this._ShellListView.IsFileExtensionShown = statef.fShowExtensions == 1;
        _IsCalledFromLoading = false;

        isOnLoad = true;

        //'load from Registry
        this.LoadRegistryRelatedSettings();

        //'set up Explorer control
        InitializeExplorerControl();

        ViewGallery.SelectedIndex = 2;

        if (this.chkUpdateCheck.IsChecked.Value) {
          this.updateCheckTimer.Start();
        }

        AddToLog("Session Began");
        isOnLoad = false;
        SetsUpJumpList();

        //Setup Clipboard monitor
        cbm.ClipboardChanged += cbm_ClipboardChanged;

        if (exitApp) {
          Application.Current.Shutdown();
          return;
        }

        // Set up Column Header menu
        chcm = new ContextMenu() { Placement = PlacementMode.MousePoint };

        //Set up Version Info
        verNumber.Content = "Version " + (Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false).FirstOrDefault() as AssemblyInformationalVersionAttribute).InformationalVersion;
        lblArchitecture.Content = Kernel32.IsThis64bitProcess() ? "64-bit version" : "32-bit version";

        tcMain_Setup(null, null);
        //'set StartUp location
        if (Application.Current.Properties["cmd"] != null && Application.Current.Properties["cmd"].ToString() != "-minimized") {
          var cmd = Application.Current.Properties["cmd"].ToString();
          if (cmd != "/nw" && cmd != "/t") {
            var sho = FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, cmd.ToShellParsingName());
            tcMain.NewTab(sho, true);
          }
        } else {
          InitializeInitialTabs();
        }

        if (!File.Exists("Settings.xml")) return;
        var Settings = XElement.Load("Settings.xml");

        if (Settings.Element("DropDownItems") != null) {
          foreach (var item in Settings.Element("DropDownItems").Elements()) {
            bcbc.DropDownItems.Add(item.Value);
          }
        }

        focusTimer.Tick += focusTimer_Tick;
      } catch (Exception exe) {
        MessageBox.Show($"An error occurred while loading the window. Please report this issue at http://bugs.gainedge.org/public/betterexplorer. \r\n\r\n Here is some information about the error: \r\n\r\n{exe.Message}\r\n\r\n{exe}", "Error While Loading", MessageBoxButton.OK, MessageBoxImage.Error);
      }
    }