public static void Show(IDesktopWindow desktopWindow, ShelfDisplayHint displayHint) { if (!PermissionsHelper.IsInRole(AuthorityTokens.KeyImages)) { throw new PolicyException(SR.ExceptionViewKeyImagePermissionDenied); } desktopWindow = desktopWindow ?? Application.ActiveDesktopWindow; IShelf shelf = GetClipboardShelf(desktopWindow); if (shelf != null) { shelf.Activate(); } else { Workspace activeWorkspace = desktopWindow.ActiveWorkspace; KeyImageInformation info = GetKeyImageInformation(activeWorkspace) ?? new KeyImageInformation(); ClipboardComponent component = new KeyImageClipboardComponent(info); shelf = ApplicationComponent.LaunchAsShelf(desktopWindow, component, SR.TitleKeyImages, displayHint); shelf.Closed += OnClipboardShelfClosed; _clipboardShelves[desktopWindow] = shelf; } }
internal static KeyImageInformation GetKeyImageInformation(IDesktopWindow desktopWindow) { IShelf shelf = GetClipboardShelf(desktopWindow); if (shelf == null) { return(null); } if (!PermissionsHelper.IsInRole(AuthorityTokens.KeyImages)) { throw new PolicyException(SR.ExceptionViewKeyImagePermissionDenied); } KeyImageClipboardComponent component = shelf.Component as KeyImageClipboardComponent; if (component != null) { return(component.KeyImageInformation); } else { return(null); } }
public KeyImageClipboardComponentControl(KeyImageClipboardComponent component) { InitializeComponent(); _component = component; _component.CurrentContextChanged += _component_CurrentContextChanged; _clipboardControl = new ClipboardComponentControl(_component) {Dock = DockStyle.Fill}; _pnlMain.Controls.Add(_clipboardControl); _cboCurrentContext.DataSource = _component.AvailableContexts; // SelectedItem needs to be explicitly initialized, because binding SelectedValue won't set correctly // SelectedValue must be the binding, because SelectedItem doesn't register property changed until control loses focus _cboCurrentContext.SelectedItem = _component.CurrentContext; _cboCurrentContext.DataBindings.Add("SelectedValue", _component, "CurrentContext", true, DataSourceUpdateMode.OnPropertyChanged); }
private static void OnWorkspaceActivated(object sender, ItemEventArgs <Workspace> e) { IShelf shelf = GetClipboardShelf(e.Item.DesktopWindow); if (shelf == null) { return; } KeyImageClipboardComponent clipboardComponent = shelf.Component as KeyImageClipboardComponent; if (clipboardComponent == null) { return; } clipboardComponent.KeyImageInformation = GetKeyImageInformation(e.Item) ?? new KeyImageInformation(); }
public static void Show(IDesktopWindow desktopWindow, ShelfDisplayHint displayHint) { if (!PermissionsHelper.IsInRole(AuthorityTokens.KeyImages)) throw new PolicyException(SR.ExceptionViewKeyImagePermissionDenied); desktopWindow = desktopWindow ?? Application.ActiveDesktopWindow; IShelf shelf = GetClipboardShelf(desktopWindow); if (shelf != null) { shelf.Activate(); } else { Workspace activeWorkspace = desktopWindow.ActiveWorkspace; KeyImageInformation info = GetKeyImageInformation(activeWorkspace) ?? new KeyImageInformation(); ClipboardComponent component = new KeyImageClipboardComponent(info); shelf = ApplicationComponent.LaunchAsShelf(desktopWindow, component, SR.TitleKeyImages, displayHint); shelf.Closed += OnClipboardShelfClosed; _clipboardShelves[desktopWindow] = shelf; } }
public void SetComponent(IApplicationComponent component) { _component = (KeyImageClipboardComponent) component; }