private ShellMenuCommandBuilder GetFileCommandBuilderTop(ShellFile file) { ShellMenuCommandBuilder builder = new ShellMenuCommandBuilder(); builder.AddCommand(new ShellMenuCommand { Flags = MFT.BYCOMMAND, Label = "Test Top", UID = (uint)CommonContextMenuItem.Properties }); if (file.IsFolder) { builder.AddCommand(new ShellMenuCommand { Flags = MFT.BYCOMMAND, Label = "This is a folder!", UID = (uint)CommonContextMenuItem.Properties }); } builder.AddSeparator(); return(builder); }
private ShellMenuCommandBuilder GetFileCommandBuilder(ShellFile file) { if (file == null) { return(new ShellMenuCommandBuilder()); } ShellMenuCommandBuilder builder = new ShellMenuCommandBuilder(); if (file.IsNavigableFolder) { if (Settings.Instance.EnableDynamicDesktop && Settings.Instance.FoldersOpenDesktopOverlay && Settings.Instance.EnableDesktop && !GroupPolicyHelper.NoDesktop) { builder.AddCommand(new ShellMenuCommand { Flags = MFT.BYCOMMAND, // enable this entry always Label = DisplayString.sStacks_OpenOnDesktop, UID = (uint)CairoContextMenuItem.OpenOnDesktop }); // If the [SHIFT] key is held, don't change the default action to ours // Only set as the default action for filesystem items because we don't support all shell views if (file.IsFileSystem && !KeyboardUtilities.IsKeyDown(System.Windows.Forms.Keys.ShiftKey)) { builder.DefaultItemUID = (uint)CairoContextMenuItem.OpenOnDesktop; } } if (StacksManager.Instance.StackLocations.All(i => i.Path != file.Path)) { builder.AddCommand(new ShellMenuCommand { Flags = MFT.BYCOMMAND, // enable this entry always Label = DisplayString.sInterface_AddToStacks, UID = (uint)CairoContextMenuItem.AddToStacks }); } else { builder.AddCommand(new ShellMenuCommand { Flags = MFT.BYCOMMAND, // enable this entry always Label = DisplayString.sInterface_RemoveFromStacks, UID = (uint)CairoContextMenuItem.RemoveFromStacks }); } builder.AddSeparator(); } return(builder); }
private ShellMenuCommandBuilder GetFileCommandBuilderBottom() { ShellMenuCommandBuilder builder = new ShellMenuCommandBuilder(); builder.AddSeparator(); builder.AddCommand(new ShellMenuCommand { Flags = MFT.BYCOMMAND, Label = "Test Bottom", UID = (uint)CommonContextMenuItem.Properties }); return(builder); }
private ShellMenuCommandBuilder GetFolderCommandBuilder() { if (folder == null) { return(new ShellMenuCommandBuilder()); } ShellMenuCommandBuilder builder = new ShellMenuCommandBuilder(); MFT flags = MFT.BYCOMMAND; if (!folder.IsFileSystem) { flags |= MFT.DISABLED; } builder.AddCommand(new ShellMenuCommand { Flags = flags, Label = "Paste", UID = (uint)CommonContextMenuItem.Paste }); builder.AddSeparator(); if (folder.IsFileSystem && folder.IsFolder) { builder.AddShellNewMenu(); builder.AddSeparator(); } builder.AddCommand(new ShellMenuCommand { Flags = flags, Label = "Properties", UID = (uint)CommonContextMenuItem.Properties }); return(builder); }
private ShellMenuCommandBuilder GetFolderCommandBuilder() { if (_desktopManager.DesktopLocation == null) { return(new ShellMenuCommandBuilder()); } ShellMenuCommandBuilder builder = new ShellMenuCommandBuilder(); MFT flags = MFT.BYCOMMAND; if (!_desktopManager.DesktopLocation.IsFileSystem) { flags |= MFT.DISABLED; } builder.AddCommand(new ShellMenuCommand { Flags = MFT.BYCOMMAND, // enable this entry always Label = Localization.DisplayString.sStacks_OpenInNewWindow, UID = (uint)CairoContextMenuItem.OpenInNewWindow }); if (StacksManager.Instance.StackLocations.All(i => i.Path != _desktopManager.DesktopLocation.Path)) { builder.AddCommand(new ShellMenuCommand { Flags = MFT.BYCOMMAND, // enable this entry always Label = Localization.DisplayString.sInterface_AddToStacks, UID = (uint)CairoContextMenuItem.AddToStacks }); } else { builder.AddCommand(new ShellMenuCommand { Flags = MFT.BYCOMMAND, // enable this entry always Label = Localization.DisplayString.sInterface_RemoveFromStacks, UID = (uint)CairoContextMenuItem.RemoveFromStacks }); } builder.AddSeparator(); builder.AddCommand(new ShellMenuCommand { Flags = flags, Label = Localization.DisplayString.sInterface_Paste, UID = (uint)CommonContextMenuItem.Paste }); builder.AddSeparator(); if (_desktopManager.DesktopLocation.IsFileSystem && _desktopManager.DesktopLocation.IsFolder) { builder.AddShellNewMenu(); builder.AddSeparator(); } if (EnvironmentHelper.IsWindows10OrBetter || !_desktopManager.DesktopLocation.IsDesktop) { // On Windows < 10, this does the same thing as Personalize when on the Desktop folder. // Show it only if this isn't the Desktop folder, or if we are on Windows 10 (or later). builder.AddCommand(new ShellMenuCommand { Flags = flags, Label = Localization.DisplayString.sInterface_Properties, UID = (uint)CommonContextMenuItem.Properties }); builder.AddSeparator(); } if (!EnvironmentHelper.IsAppRunningAsShell) { // Don't show this if we are shell, since this launches a UWP app builder.AddCommand(new ShellMenuCommand { Flags = MFT.BYCOMMAND, // enable this entry always Label = Localization.DisplayString.sDesktop_DisplaySettings, UID = (uint)CairoContextMenuItem.DisplaySettings }); } builder.AddCommand(new ShellMenuCommand { Flags = MFT.BYCOMMAND, // enable this entry always Label = Localization.DisplayString.sDesktop_Personalize, UID = (uint)CairoContextMenuItem.Personalize }); return(builder); }