2
0

Clipboard.cs 702 B

1234567891011121314151617181920212223242526272829303132
  1. using NStack;
  2. using System;
  3. namespace Terminal.Gui {
  4. /// <summary>
  5. /// Provides cut, copy, and paste support for the clipboard with OS interaction.
  6. /// </summary>
  7. public static class Clipboard {
  8. static ustring contents;
  9. /// <summary>
  10. /// Get or sets the operation system clipboard, otherwise the contents field.
  11. /// </summary>
  12. public static ustring Contents {
  13. get {
  14. try {
  15. return Application.Driver.Clipboard.GetClipboardData ();
  16. } catch (Exception) {
  17. return contents;
  18. }
  19. }
  20. set {
  21. try {
  22. Application.Driver.Clipboard.SetClipboardData (value.ToString ());
  23. contents = value;
  24. } catch (Exception) {
  25. contents = value;
  26. }
  27. }
  28. }
  29. }
  30. }