private void OnApplicationExit(object sender, EventArgs e) { keyboardWatcher.Stop(); mouseWatcher.Stop(); clipboardWatcher.Stop(); applicationWatcher.Stop(); printWatcher.Stop(); eventHookFactory.Dispose(); }
public static void Stop() { context = null; OnClipboardChange = null; ClipboardWatcher.Stop(); }
public void BeginWatching(Models.SocketMessageHandler connectionToSendChanges) { if (ClipboardWatcher?.Enabled == true) { ClipboardWatcher.Stop(); } ClipboardWatcher = new System.Timers.Timer(500); ClipboardWatcher.Elapsed += (sender, args) => { MainWindow.Current.Dispatcher.Invoke(() => { try { if (!Clipboard.IsCurrent(ClipboardData)) { ClipboardData = Clipboard.GetDataObject(); var jsonData = GetTransferData(); if (!string.IsNullOrWhiteSpace(jsonData.Format)) { connectionToSendChanges.SendJSON(jsonData); } } } catch { if (!connectionToSendChanges.IsConnected) { ClipboardWatcher.Stop(); } } }); }; ClipboardWatcher.Start(); }
private void ClipboardOpen(object sender, ClipboardEventArgs e) { if (copied) { return; } copied = true; Thread.Sleep(150); ClipboardWatcher.Stop(); callback.OnClipboardCopy(Clipboard.GetText(TextDataFormat.Text)); }
public void BeginWatching(Models.SocketMessageHandler connectionToSendChanges) { try { if (ClipboardWatcher?.Enabled == true) { ClipboardWatcher.Stop(); } ClipboardData = Clipboard.GetDataObject(); Clipboard.SetDataObject(ClipboardData); ClipboardWatcher = new System.Timers.Timer(500); } catch { return; } ClipboardWatcher.Elapsed += (sender, args) => { if (!Config.Current.IsClipboardShared) { ClipboardWatcher.Stop(); return; } MainWindow.Current.Dispatcher.Invoke(() => { try { if (!Clipboard.IsCurrent(ClipboardData)) { ClipboardData = Clipboard.GetDataObject(); var jsonData = GetTransferData(); if (!string.IsNullOrWhiteSpace(jsonData.Format)) { connectionToSendChanges.SendJSON(jsonData); } } } catch (Exception ex) { if (connectionToSendChanges?.IsConnected != true) { ClipboardWatcher.Stop(); } else { Utilities.WriteToLog(ex); } } }); }; ClipboardWatcher.Start(); }
public void OnExit() { //keyboardMouseSimulator.releaseCtrl(); ClipboardWatcher.Stop(); KeyboardWatcher.Stop(); MouseWatcher.Stop(); Console.WriteLine("done!"); Application.Exit(); try { Environment.Exit(1); } catch (Exception e) { Console.WriteLine(e.Message); } }
private void CtxMenuStripNotify_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem != quitToolStripMenuItem) { // get the full item var item = Clips.Where(c => c.Key == (Guid)e.ClickedItem.Tag).FirstOrDefault(); ClipboardWatcher.Stop(); Clipboard.SetText(item.Value); ClipboardWatcher.Start(); // remove it from the current position and add to the end (latest) Clips.Remove(item); Clips.Add(item); } }
static void Main(string[] args) { KeyboardWatcher.Start(); KeyboardWatcher.OnKeyInput += (s, e) => { Console.WriteLine(string.Format("Key {0} event of key {1}", e.KeyData.EventType, e.KeyData.Keyname)); }; MouseWatcher.Start(); MouseWatcher.OnMouseInput += (s, e) => { Console.WriteLine(string.Format("Mouse event {0} at point {1},{2}", e.Message.ToString(), e.Point.x, e.Point.y)); }; ClipboardWatcher.Start(); ClipboardWatcher.OnClipboardModified += (s, e) => { Console.WriteLine(string.Format("Clipboard updated with data '{0}' of format {1}", e.Data, e.DataFormat.ToString())); }; ApplicationWatcher.Start(); ApplicationWatcher.OnApplicationWindowChange += (s, e) => { Console.WriteLine(string.Format("Application window of '{0}' with the title '{1}' was {2}", e.ApplicationData.AppName, e.ApplicationData.AppTitle, e.Event)); }; PrintWatcher.Start(); PrintWatcher.OnPrintEvent += (s, e) => { Console.WriteLine(string.Format("Printer '{0}' currently printing {1} pages.", e.EventData.PrinterName, e.EventData.Pages)); }; Console.Read(); KeyboardWatcher.Stop(); MouseWatcher.Stop(); ClipboardWatcher.Stop(); ApplicationWatcher.Stop(); PrintWatcher.Stop(); }
private void CleanUp() { keyboardWatcher.Stop(); mouseWatcher.Stop(); clipboardWatcher.Stop(); applicationWatcher.Stop(); printWatcher.Stop(); eventHookFactory.Dispose(); recorder?.Dispose(); converter?.Close(); webServer?.Stop(); if (isRecording) { eventWriter.DeleteAllFiles(); if (File.Exists(filePath + "\\Record" + timestamp + ".avi")) { File.Delete(filePath + "\\Record" + timestamp + ".avi"); } } }
private void SendHexBack() { var hexCopied = Clipboard.GetText(TextDataFormat.Text); ClipboardWatcher.Stop(); }
public static void Stop() { ClipboardWatcher.OnClipboardChange -= OnClipboardChangeEvent; ClipboardWatcher.Stop(); }
public void StopWatching() { ClipboardWatcher?.Stop(); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { ClipboardWatcher.Stop(); }
public static void Stop() { OnClipboardChange = null; ClipboardWatcher.OnClipboardChange -= Helper; ClipboardWatcher.Stop(); }