Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Threading;
  5. using System.Windows.Forms;
  6.  
  7. namespace dIRC7
  8. {
  9. public class IRCClipBoard
  10. {
  11. string Data;
  12.  
  13. public void AddDataToClipboard(string Text)
  14. {
  15. if (String.IsNullOrEmpty(Text))
  16. {
  17. return;
  18. }
  19. Data = Text;
  20. Thread ClipboardThread = new Thread(_ClipboardWaiter);
  21. ClipboardThread.Start();
  22. }
  23.  
  24. private void _ClipboardWaiter()
  25. {
  26. bool bSuccess = false;
  27. while (!bSuccess)
  28. {
  29. // load clipboard data untill it actually loads.
  30. try
  31. {
  32. Clipboard.SetText(Data);
  33. bSuccess = true;
  34. break;
  35. }
  36. catch
  37. {
  38. Thread.Sleep(500);
  39. }
  40. }
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement