Represents a pop-up menu that enables a control to expose functionality that is specific to the context of the control
상속: System.Windows.Controls.ContextMenu
예제 #1
0
    void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
    {
        switch (connectionId)
        {
        case 1:
            this.DocBox = ((TabHeader)(target));
            return;

        case 2:
            this.Docker = ((System.Windows.Controls.DockPanel)(target));
            return;

        case 3:
            this.HeaderMenu = ((Fluent.ContextMenu)(target));
            return;

        case 4:
            this.SaveMenuItem = ((Fluent.MenuItem)(target));
            return;

        case 5:
            this.SaveAsMenuItem = ((Fluent.MenuItem)(target));
            return;

        case 6:
            this.SaveAllMenuItem = ((Fluent.MenuItem)(target));
            return;

        case 7:
            this.CloseMenuItem = ((Fluent.MenuItem)(target));
            return;

        case 8:
            this.CloseAllMenuItem = ((Fluent.MenuItem)(target));
            return;

        case 9:
            this.FileTypeImage = ((System.Windows.Controls.Image)(target));
            return;

        case 10:
            this.TabTitle = ((System.Windows.Controls.TextBlock)(target));
            return;

        case 11:
            this.TabToolTip = ((Fluent.ScreenTip)(target));
            return;

        case 12:
            this.CloseButton = ((Fluent.Button)(target));
            return;
        }
        this._contentLoaded = true;
    }
예제 #2
0
    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);
      }
    }
        // Creates context menu
        void CreateMenu()
        {
            isInitializing = true;
            isMenuCreated = true;
            if (dropDownMenu==null) dropDownMenu = new ContextMenu();            
            foreach (UIElement item in Items)
            {
                RemoveLogicalChild(item);
                dropDownMenu.Items.Add(item);
            }          
            AddLogicalChild(dropDownMenu.RibbonPopup);
            dropDownMenu.IsOpen = true;
            dropDownMenu.RibbonPopup.Opened += OnMenuOpened;
            dropDownMenu.RibbonPopup.Closed += OnMenuClosed;

            Binding binding = new Binding("IsOpen");
            binding.Mode = BindingMode.TwoWay;
            binding.Source = this;
            dropDownMenu.SetBinding(Fluent.ContextMenu.IsOpenProperty, binding);

            Binding resizeModeBinding = new Binding("ResizeMode");
            resizeModeBinding.Mode = BindingMode.OneWay;
            resizeModeBinding.Source = this;
            dropDownMenu.SetBinding(Fluent.ContextMenu.ResizeModeProperty, resizeModeBinding);

            dropDownMenu.PlacementTarget = this;
            dropDownMenu.Placement = PlacementMode.Bottom;            
            
            isInitializing = false;
            Mouse.Capture(null);
            IsOpen = true;
            dropDownMenu.IsOpen = true;
        }
예제 #4
0
        // Creates context menu
        void CreateMenu()
        {
            contextMenu = new ContextMenu();
            foreach (UIElement item in Items)
            {
                RemoveLogicalChild(item);
                contextMenu.Items.Add(item);
            }
            contextMenu.IsOpen = true;
            Binding binding = new Binding("IsOpen");
            binding.Mode = BindingMode.TwoWay;
            binding.Source = this;
            contextMenu.SetBinding(Fluent.ContextMenu.IsOpenProperty, binding);
            
            contextMenu.PlacementTarget = this;
            contextMenu.Placement = PlacementMode.Right;

            AddLogicalChild(contextMenu.RibbonPopup);
        }