private void _listener_Changed(object sender, ClipboardChangedEventArgs e) { // Note: in WinDBG, the same content is copied to the clipboard TWICE. // so we need to skip the notifications that occurs too close from // the previous one. var now = DateTime.UtcNow; if (now.Subtract(_lastClipboardNotificationTime) < MIN_ELAPSE_SINCE_CLIPBOARD_NOTIFICATION) { return; } _lastClipboardNotificationTime = now; // TODO: make this "maybe long" treatment asynchronous if needed // // Check if this is a supported format HeapSnapshot snapshot = GetSnapshotFromClipboard(); if (snapshot == null) { return; } AddOneSnapshot(snapshot); }
private void OnGlobalHookClipboard(object sender, ClipboardChangedEventArgs e) { if (!ClientState.CurrentClientFocused) { //Console.WriteLine("Trying to set the clipboard when we're not the current client..."); return; } //if our application has received a clipboard push from the server, this event still fires, so bail out if we are currently syncing the clipboard. //don't process a hook event within 2 seconds #if BailClient if (ShouldHookBailKeyboard()) { return; } ClientState.LastHookEvent_Keyboard = DateTime.UtcNow; #endif //Console.WriteLine("Sending clipboard to server"); #if QUEUE_CLIENT _dispatcher.Process(new ClipboardMessage(e.Value)); #else _dispatcher.Send(ClipboardMessage.GetBytes(e.Value)); #endif }
private static void ClipboardChanged(Object sender, ClipboardChangedEventArgs e) { // Is the content copied of text type? if (e.ContentType == SharpClipboard.ContentTypes.Text) { // Get the cut/copied text. Console.WriteLine(clipboard.ClipboardText); } // Is the content copied of image type? else if (e.ContentType == SharpClipboard.ContentTypes.Image) { // Get the cut/copied image. //Image img = clipboard.ClipboardImage; } // Is the content copied of file type? else if (e.ContentType == SharpClipboard.ContentTypes.Files) { // Get the cut/copied file/files. //Debug.WriteLine(clipboard.ClipboardFiles.ToArray()); // ...or use 'ClipboardFile' to get a single copied file. //Debug.WriteLine(clipboard.ClipboardFile); } // If the cut/copied content is complex, use 'Other'. else if (e.ContentType == SharpClipboard.ContentTypes.Other) { // Do something with 'clipboard.ClipboardObject' or 'e.Content' here... } }
private void ClipboardChanged(Object sender, ClipboardChangedEventArgs e) { if (e.ContentType == SharpClipboard.ContentTypes.Text && clipboard.ClipboardText[0] == '[') { // TODO: как то тут проверить фит это или не фит! list.SetText(clipboard.ClipboardText); } }
private void OnClipboardChanged(object sender, ClipboardChangedEventArgs e) { if (!String.IsNullOrEmpty(e.TextPlain)) { ServerConnection.CurrentServer?.SendClipboardContent(e.TextPlain, e.TextHtml); } else if (e.ModeChange) { ServerConnection.CurrentServer?.SendShareRemoteClipboard(BbSharedClipboard.IsSharedRemote); } }
WndProc(ref System.Windows.Forms.Message m) { switch (m.Msg) { /* * case API.WM_CLOSE: * if (this.bChained == true) * ChainClipboard(false); * break; */ case API.WM_DRAWCLIPBOARD: if (this.bChained == true) { if (this.ClipboardChanged != null && this.Ignore == false) { ClipboardChangedEventArgs e = new ClipboardChangedEventArgs(); this.ClipboardChanged(this, e); } // 第一次API.SetClipboardViewer调用, 会触发这个事件, 因此需要用bChained变量来阻止这一次 API.SendMessage(nextClipboardViewer, m.Msg, m.WParam, m.LParam); } break; case API.WM_CHANGECBCHAIN: if (m.WParam == nextClipboardViewer) { nextClipboardViewer = m.LParam; } else { if (this.bChained == true) { API.SendMessage(nextClipboardViewer, m.Msg, m.WParam, m.LParam); } } break; default: base.WndProc(ref m); break; } }
private void MainClipboardMonitor_ClipboardChanged(object sender, ClipboardChangedEventArgs e) { string clipboardText = string.Empty; try { clipboardText = e.DataObject.GetData(System.Windows.Forms.DataFormats.UnicodeText).ToString(); } catch (Exception ex) { clipboardText = "Exception Occured while capturing clipboard: " + ex.ToString(); } finally { WriteToLog(clipboardText); } }
private void ClipboardChanged(Object sender, ClipboardChangedEventArgs e) { // Is the content copied of text type? if (e.ContentType == SharpClipboard.ContentTypes.Text) { var text = clipboard.ClipboardText; if (!text.StartsWith("KATACODE:")) { return; } ParseKata(text); if (chkAuto.Checked) { btnCreateFile.PerformClick(); } } // Is the content copied of image type? else if (e.ContentType == SharpClipboard.ContentTypes.Image) { // Get the cut/copied image. //Image img = clipboard.ClipboardImage; } // Is the content copied of file type? else if (e.ContentType == SharpClipboard.ContentTypes.Files) { // Get the cut/copied file/files. //Debug.WriteLine(clipboard.ClipboardFiles.ToArray()); // ...or use 'ClipboardFile' to get a single copied file. //Debug.WriteLine(clipboard.ClipboardFile); } // If the cut/copied content is complex, use 'Other'. else if (e.ContentType == SharpClipboard.ContentTypes.Other) { // Do something with 'clipboard.ClipboardObject' or 'e.Content' here... } }
private void _globalHook_Clipboard(object sender, ClipboardChangedEventArgs e) { if (!ClientState.CurrentClientFocused) { //Console.WriteLine("Trying to set the clipboard when we're not the current client..."); return; } //if our application has received a clipboard push from the server, this event still fires, so bail out if we are currently syncing the clipboard. //don't process a hook event within 2 seconds if (ShouldHookBailKeyboard()) { return; } ClientState.LastHookEvent_Keyboard = DateTime.Now; //Console.WriteLine("Sending clipboard to server"); _dispatcher.Clipboard(e.Value); }
private void ClipboardChanged(Object sender, ClipboardChangedEventArgs e) { // Is the content copied of text type? if (Clipboard.ContainsText()) { if (e.Content.ToString() != clipboardCache) { // Get the cut/copied text. clipboardCache = e.Content.ToString(); clipboardTimer.Start(); textHandling.UploadText(e.Content.ToString()); Notifiercs notifiercs = new Notifiercs(); //notifiercs.notifier.ShowSuccess("Clipboard uploaded"); } } // Is the content copied of image type? else if (Clipboard.ContainsImage() || Handlers.ClipBoardContainsDropFileImg()) { // Get the cut/copied image. new PictureHandling.PictureUpload(); } // Is the content copied of file type? else if (e.ContentType == SharpClipboard.ContentTypes.Files) { // Get the cut/copied file/files. //Debug.WriteLine(clipboard.ClipboardFiles.ToArray()); // ...or use 'ClipboardFile' to get a single copied file. //Debug.WriteLine(clipboard.ClipboardFile); } // If the cut/copied content is complex, use 'Other'. else if (e.ContentType == SharpClipboard.ContentTypes.Other) { // Do something with 'clipboard.ClipboardObject' or 'e.Content' here... } }
void clipboardMonitor_ClipboardChanged(object sender, ClipboardChangedEventArgs e) { IDataObject iData = Clipboard.GetDataObject(); // Determines whether the data is in a format you can use. if (iData.GetDataPresent(DataFormats.Text)) { // Yes it is, so display it in a text box. string strText = (String)iData.GetData(DataFormats.Text); // MessageBox.Show(this, strText); if (strText.Length > 0) { this.textBox_author.Text = strText; button_get_Click(null, EventArgs.Empty); } } else { // 格式无法支持, 忽略 // MessageBox.Show(this, "Could not retrieve data off the clipboard."); } }
private void ClipboardMonitor_ClipboardUpdated(object sender, ClipboardChangedEventArgs args) { }
private void PlaintextClipboardAccessor(object sender, ClipboardChangedEventArgs <string> e) { plaintextTextbox.Text = e.Value; }
private void ClipboardAccessor(object sender, ClipboardChangedEventArgs <RtfString> e) { rtfTextbox.Rtf = e.Value; }
void cm_ClipboardChanged(object sender, ClipboardChangedEventArgs e) { Console.WriteLine(e.ClipboardContent); }
private void ClipboardChange(object sender, ClipboardChangedEventArgs e) { InsertImageFromClipboard(false); }