using Caliburn.Micro; using System.ComponentModel.Composition; using VisualComponents.UX.Shared; namespace Plugin.Demo { [Export(typeof(IDockableScreen))] public class DemoViewModel : DockableScreen { public DemoViewModel() { PanelId = "VCDemo"; DisplayName = "Demo"; PaneLocation = DesiredPaneLocation.DockedRight; } } [Export(typeof(IActionItem))] [PartCreationPolicy(CreationPolicy.Shared)] public class DisplayPanel : ActionItem { IDockAwareWindowManager dockManager; public DisplayPanel() : base("VcDisplayPanel") { execute = Execute; // Use the AttachTo property to bind keyboard Control + T to // this action item Execute command AttachTo = "[Shortcut Control + T] = [Action Execute];[Event Click] = [Action Execute]"; dockManager = IoC.Get<IDockAwareWindowManager>(); } public override void Execute() { foreach (IDockableScreen screen in dockManager.DockPanels) { if (screen.PanelId == "VCDemo") { if (screen.IsVisible) { dockManager.SetScreenVisibility(screen, false); } else { dockManager.SetScreenVisibility(screen, true); } } } } } }