IClipboard.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Terminal.Gui {
  7. /// <summary>
  8. /// Definition to interact with the OS clipboard.
  9. /// </summary>
  10. public interface IClipboard {
  11. /// <summary>
  12. /// Returns true if the environmental dependencies are in place to interact with the OS clipboard.
  13. /// </summary>
  14. bool IsSupported { get; }
  15. /// <summary>
  16. /// Get the operation system clipboard.
  17. /// </summary>
  18. /// <exception cref="NotSupportedException">Thrown if it was not possible to read the clipboard contents.</exception>
  19. string GetClipboardData ();
  20. /// <summary>
  21. /// Gets the operation system clipboard if possible.
  22. /// </summary>
  23. /// <param name="result">Clipboard contents read</param>
  24. /// <returns>true if it was possible to read the OS clipboard.</returns>
  25. bool TryGetClipboardData (out string result);
  26. /// <summary>
  27. /// Sets the operation system clipboard.
  28. /// </summary>
  29. /// <param name="text"></param>
  30. /// <exception cref="NotSupportedException">Thrown if it was not possible to set the clipboard contents.</exception>
  31. void SetClipboardData (string text);
  32. /// <summary>
  33. /// Sets the operation system clipboard if possible.
  34. /// </summary>
  35. /// <param name="text"></param>
  36. /// <returns>True if the clipboard content was set successfully.</returns>
  37. bool TrySetClipboardData (string text);
  38. }
  39. }