예제 #1
0
 void CListener_ClipboardChange(object sender, RawClipboardEventArgs args)
 {
     if (CSender != null)
     {
         if (!CSender.justReceivedContent)
         {
             Thread t = new Thread(() => CSender.SendClipboard());
             t.SetApartmentState(ApartmentState.STA);
             t.Start();
         }
         else
         {
             CSender.justReceivedContent = false;
         }
     }
 }
예제 #2
0
 private void ActivateControl(object sender, EventArgs e)
 {
     if (connected && firstTimeActivated)
     {
         firstTimeActivated = false;
         InitHooks();
         try
         {
             string restartMessage = "<Restart>";
             byte[] restartToByte  = Encoding.Unicode.GetBytes(restartMessage);
             int    bytesSend      = controlSocket.Send(restartToByte);
         }
         catch (ObjectDisposedException) {}
         Thread t = new Thread(() => CSender.SendClipboard());
         t.SetApartmentState(ApartmentState.STA);
         t.Start();
     }
 }