/// <summary> /// Tries to restore clipboard with provided SlideRange first, then ShapeRange then finally Shape. /// Note that clipboard cannot be restored if last copied item was a placeholder (for now) /// </summary> /// <returns>True if successfully restored</returns> private static void RestoreClipboard(Shape shape = null, ShapeRange shapes = null, SlideRange slides = null) { try { if (slides != null) { slides.Copy(); slides.Delete(); } else if (shapes != null && shapes.Count >= 1) { shapes.Copy(); shapes.Delete(); } else if (shape != null) { shape.Copy(); shape.Delete(); } } catch (COMException e) { // May be thrown when trying to copy Logger.LogException(e, "RestoreClipboard"); } }
/// <summary> /// Tries to restore clipboard with provided SlideRange first, then ShapeRange then finally Shape. /// Note that clipboard cannot be restored if last copied item was a placeholder (for now) /// </summary> /// <returns>True if successfully restored</returns> private static void RestoreClipboard(ShapeRange shapes = null, SlideRange slides = null) { try { PPLClipboard.Instance.LockAndRelease(() => { if (slides != null) { slides.Copy(); slides.Delete(); } else if (shapes != null && shapes.Count >= 1) { shapes.Copy(); shapes.SafeDelete(); } }); } catch (COMException e) { // May be thrown when trying to copy Logger.LogException(e, "RestoreClipboard"); } }