/// <summary> /// Returns a value indicating if the active context can copy the selection to the clipboard</summary> /// <returns>True iff the active context can copy to the clipboard</returns> public bool CanCopy() { IInstancingContext instancingContext = m_contextRegistry.GetActiveContext <IInstancingContext>(); return (instancingContext != null && instancingContext.CanCopy()); }
/// <summary> /// Checks whether the client can do the command, if it handles it</summary> /// <param name="commandTag">Command to be done</param> /// <returns>True iff client can do the command</returns> bool ICommandClient.CanDoCommand(object commandTag) { bool canDo = false; IInstancingContext instancingContext = m_contextRegistry.GetActiveContext <IInstancingContext>(); switch ((StandardCommand)commandTag) { case StandardCommand.EditCut: canDo = instancingContext != null && instancingContext.CanCopy() && instancingContext.CanDelete(); break; case StandardCommand.EditDelete: canDo = instancingContext != null && instancingContext.CanDelete(); break; case StandardCommand.EditCopy: canDo = instancingContext != null && instancingContext.CanCopy(); break; case StandardCommand.EditPaste: canDo = instancingContext != null && CanPaste(); break; } return(canDo); }
/// <summary> /// Copies the active context's selection to the clipboard</summary> public void Copy() { IInstancingContext instancingContext = m_contextRegistry.GetActiveContext <IInstancingContext>(); if (instancingContext != null && instancingContext.CanCopy()) { object rawObject = instancingContext.Copy(); IDataObject dataObject = rawObject as IDataObject ?? new DataObject(rawObject); OnCopying(EventArgs.Empty); Clipboard = dataObject; OnCopied(EventArgs.Empty); } }