IClipboard.cs 1.2 KB

123456789101112131415161718192021222324252627
  1. namespace Terminal.Gui;
  2. /// <summary>Definition to interact with the OS clipboard.</summary>
  3. public interface IClipboard
  4. {
  5. /// <summary>Returns true if the environmental dependencies are in place to interact with the OS clipboard.</summary>
  6. bool IsSupported { get; }
  7. /// <summary>Get the operating system clipboard.</summary>
  8. /// <exception cref="NotSupportedException">Thrown if it was not possible to read the clipboard contents.</exception>
  9. string GetClipboardData ();
  10. /// <summary>Sets the operating system clipboard.</summary>
  11. /// <param name="text"></param>
  12. /// <exception cref="NotSupportedException">Thrown if it was not possible to set the clipboard contents.</exception>
  13. void SetClipboardData (string text);
  14. /// <summary>Gets the operating system clipboard if possible.</summary>
  15. /// <param name="result">Clipboard contents read</param>
  16. /// <returns>true if it was possible to read the OS clipboard.</returns>
  17. bool TryGetClipboardData (out string result);
  18. /// <summary>Sets the operating system clipboard if possible.</summary>
  19. /// <param name="text"></param>
  20. /// <returns>True if the clipboard content was set successfully.</returns>
  21. bool TrySetClipboardData (string text);
  22. }