using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; using ActiproSoftware.Windows.Controls.Grids; using ActiproSoftware.Windows.Controls.Shell; using Orbit.Module.Actions; using Orbit.Module.Actions.PhotoshopActions; using Plume.Interfaces.WPF; using Plume.Interfaces.WPF.Actions; using ShowInP4VAction = Orbit.Module.Actions.ShowInP4VAction; namespace Orbit.Module.ViewModel { public class ShellObjectCustomAdapter : ShellObjectItemAdapter { public override ContextMenu GetBackgroundContextMenu(TreeListBox ownerControl, ShellObjectViewModel rootViewModel) { return null; } public override ContextMenu GetItemContextMenu(TreeListBox ownerControl, IList viewModels) { var paths = new List(); foreach (var vm in viewModels) { paths.Add(vm.FileSystemPath); } var context = new ContextMenu(); var actionManager = ((IWpfApplication)Application.Current).ActionManager; if (viewModels.Any(x => !x.IsFolder)) { var placeInPSItem = actionManager.Get().ToMenuItem(); context.Items.Add(placeInPSItem); } var showInExplorerItem = actionManager.Get().ToMenuItem(); showInExplorerItem.CommandParameter = paths; context.Items.Add(showInExplorerItem); if (paths.Count == 1) { var showInP4VItem = actionManager.Get().ToMenuItem(); showInP4VItem.CommandParameter = paths[0]; context.Items.Add(showInP4VItem); } return context; } } }