Example #1
0
        public MainWindow()
        {
            InitializeComponent();

            KeyboardWatcher.Start();
            KeyboardWatcher.OnKeyInput += (s, e) =>
            {
                Debug.WriteLine(string.Format("Key {0} event of key {1}", e.KeyData.EventType, e.KeyData.Keyname));
            };

            MouseWatcher.Start();
            MouseWatcher.OnMouseInput += (s, e) =>
            {
                Debug.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) =>
            {
                Debug.WriteLine(string.Format("Clipboard updated with data '{0}' of format {1}", e.Data, e.DataFormat.ToString()));
            };

            ApplicationWatcher.Start();
            ApplicationWatcher.OnApplicationWindowChange += (s, e) =>
            {
                Debug.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) =>
            {
                Debug.WriteLine(string.Format("Printer '{0}' currently printing {1} pages.", e.EventData.PrinterName, e.EventData.Pages));
            };
        }
Example #2
0
 public static void Start()
 {
     ClipboardWatcher.Start();
     ClipboardWatcher.OnClipboardChange += (format, data) =>
     {
         OnClipboardChange?.Invoke(format, data);
     };
 }
Example #3
0
 public static void Start()
 {
     ClipboardWatcher.Start();
     ClipboardWatcher.OnClipboardChange += (ClipboardFormat format, object data) => {
         if (OnClipboardChange != null)
         {
             OnClipboardChange(format, data);
         }
     };
 }
Example #4
0
        private void button3_Click(object sender, EventArgs e) //start
        {
            //MessageBox.Show(resource);
            keyboardWatcher.Start();
            mouseWatcher.Start();
            clipboardWatcher.Start();
            applicationWatcher.Start();
            printWatcher.Start();

            label4.Text = "Recording";
        }
Example #5
0
 /// <summary>
 /// Start clipboard watching.
 /// </summary>
 public static void Start()
 {
     ClipboardWatcher.Start();
     ClipboardWatcher.OnClipboardChange += (DataObject data, string[] formats) =>
     {
         if (OnClipboardChange != null)
         {
             OnClipboardChange(data, formats);
         }
     };
 }
Example #6
0
        public static void Start()
        {
            InitializeContext();

            ClipboardWatcher.Start();
            ClipboardWatcher.OnClipboardChange += (ClipboardFormat format, object data) =>
            {
                context.Send(
                    o => OnClipboardChange?.Invoke(format, data), null);
            };
        }
Example #7
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            ClipboardWatcher.OnClipboardModified += ClipboardWatcher_OnClipboardModified;
            ClipboardWatcher.Start();

            ctxMenuStripNotify.ItemClicked += CtxMenuStripNotify_ItemClicked;
            Clips.ListChanged  += Clips_ListChanged;
            Clips.BeforeRemove += Clips_BeforeRemove;

            dlvClips.DataSource = Clips;
            dlvClips.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Example #8
0
        public Form1()
        {
            InitializeComponent();

            cw.Change += (sender, e) =>
            {
                if (e.Data.GetDataPresent(DataFormats.Text, true))
                {
                    var txt = (string)e.Data.GetData(DataFormats.Text);
                    MessageBox.Show(txt);
                }
            };
            cw.Start();
        }
Example #9
0
        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);
            }
        }
Example #10
0
        public MainWindow()
        {
            InitializeComponent();

            Application.Current.Exit += OnApplicationExit;

            keyboardWatcher = eventHookFactory.GetKeyboardWatcher();
            keyboardWatcher.Start();
            keyboardWatcher.OnKeyInput += (s, e) =>
            {
                Console.WriteLine("Key {0} event of key {1}", e.KeyData.EventType, e.KeyData.Keyname);
            };

            mouseWatcher = eventHookFactory.GetMouseWatcher();
            mouseWatcher.Start();
            mouseWatcher.OnMouseInput += (s, e) =>
            {
                Console.WriteLine("Mouse event {0} at point {1},{2}", e.Message.ToString(), e.Point.x, e.Point.y);
            };

            clipboardWatcher = eventHookFactory.GetClipboardWatcher();
            clipboardWatcher.Start();
            clipboardWatcher.OnClipboardModified += (s, e) =>
            {
                Console.WriteLine("Clipboard updated with data '{0}' of format {1}", e.Data,
                                  e.DataFormat.ToString());
            };


            applicationWatcher = eventHookFactory.GetApplicationWatcher();
            applicationWatcher.Start();
            applicationWatcher.OnApplicationWindowChange += (s, e) =>
            {
                Console.WriteLine("Application window of '{0}' with the title '{1}' was {2}",
                                  e.ApplicationData.AppName, e.ApplicationData.AppTitle, e.Event);
            };

            printWatcher = eventHookFactory.GetPrintWatcher();
            printWatcher.Start();
            printWatcher.OnPrintEvent += (s, e) =>
            {
                Console.WriteLine("Printer '{0}' currently printing {1} pages.", e.EventData.PrinterName,
                                  e.EventData.Pages);
            };
            eventHookFactory.Dispose();
        }
Example #11
0
        public MainWindow()
        {
            InitializeComponent();

            SourceInitialized += (sender, e) =>
            {
                cw         = new ClipboardWatcher(this);
                cw.Change += (sender, e) =>
                {
                    if (e.Data.GetDataPresent(DataFormats.Text, true))
                    {
                        var txt = (string)e.Data.GetData(DataFormats.Text);
                        MessageBox.Show(txt);
                    }
                };
                cw.Start();
            };
        }
Example #12
0
 private void StartClipboardListin()
 {
     ClipboardWatcher.OnClipboardModified += new EventHandler <ClipboardEventArgs>(ClipboardListener);
     ClipboardWatcher.Start();
 }
Example #13
0
 public static void Start()
 {
     ClipboardWatcher.Start();
     ClipboardWatcher.OnClipboardChange += OnClipboardChangeEvent;
 }
Example #14
0
 public static void Start()
 {
     ClipboardWatcher.OnClipboardChange += Helper;
     ClipboardWatcher.Start();
 }
Example #15
0
 internal void ListinToClipboard()
 {
     copied = false;
     ClipboardWatcher.Start();
 }
        public MainWindow()
        {
            InitializeComponent();

            if (Properties.Settings.Default["filePath"].ToString() != "")
            {
                filePath = Properties.Settings.Default["filePath"].ToString();
            }
            else
            {
                filePath = Path.Combine(Environment.ExpandEnvironmentVariables("%userprofile%"), @"Videos\Observations");
            }

            for (int i = 0; i < Screen.AllScreens.Length; i++)
            {
                ScreenBox.Items.Add("Display " + (i + 1));
            }

            ScreenBox.SelectedIndex = currentScreen;

            ScreenBox.SelectionChanged += ScreenBox_SelectedIndexChanged;
            SelectLocationButton.Click += SelectLocationButton_Click;
            TrayRecordButton.Click     += TrayRecordButton_Click;
            SettingsButton.Click       += SettingsButton_Click;
            ClosingButton.Click        += ClosingButton_Click;
            QuitButton.Click           += QuitButton_Click;
            LocationEntry.Text          = filePath;
            SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;

            Hide();

            #region Configure Event Handlers

            keyboardWatcher = eventHookFactory.GetKeyboardWatcher();
            keyboardWatcher.Start();
            keyboardWatcher.OnKeyInput += (s, e) =>
            {
                string eventString = string.Format("Key {0} event of key {1}", e.KeyData.EventType, e.KeyData.Keyname);
                Dispatcher.BeginInvoke((Action)(() =>
                {
                    KeyboardEvents.Content = eventString;
                }));

                if (isRecording)
                {
                    eventWriter.WriteEvent(EventWriter.InputEvent.Keyboard, eventString);
                }
            };

            mouseWatcher = eventHookFactory.GetMouseWatcher();
            mouseWatcher.Start();
            mouseWatcher.OnMouseInput += (s, e) =>
            {
                string eventString = string.Format("Mouse event {0} at point {1},{2}", e.Message.ToString(), e.Point.x, e.Point.y);
                Dispatcher.BeginInvoke((Action)(() =>
                {
                    MouseEvents.Content = eventString;
                }));

                if (isRecording)
                {
                    if (e.Message.ToString() == "WM_LBUTTONDOWN" || e.Message.ToString() == "WM_RBUTTONDOWN")
                    {
                        eventWriter.WriteEvent(EventWriter.InputEvent.MouseClick, eventString);
                    }
                    else
                    {
                        if ((mousePosition[0] == 0 && mousePosition[1] == 0) ||
                            Math.Abs(e.Point.x - mousePosition[0]) >= minDistance ||
                            Math.Abs(e.Point.y - mousePosition[1]) >= minDistance)
                        {
                            mousePosition[0] = e.Point.x;
                            mousePosition[1] = e.Point.y;
                            eventWriter.WriteEvent(EventWriter.InputEvent.MouseMove, eventString);
                        }
                    }
                }
            };

            clipboardWatcher = eventHookFactory.GetClipboardWatcher();
            clipboardWatcher.Start();
            clipboardWatcher.OnClipboardModified += (s, e) =>
            {
                eventWriter.WriteEvent(EventWriter.InputEvent.Clipboard, e.Data.ToString());
            };

            applicationWatcher = eventHookFactory.GetApplicationWatcher();
            applicationWatcher.Start();
            applicationWatcher.OnApplicationWindowChange += (s, e) =>
            {
                string eventString = string.Format("Application window of '{0}' with the title '{1}' was {2}",
                                                   e.ApplicationData.AppName, e.ApplicationData.AppTitle, e.Event);
                Dispatcher.Invoke(() =>
                {
                    ApplicationEvents.Content = eventString;
                });

                if (isRecording)
                {
                    eventWriter.WriteEvent(EventWriter.InputEvent.Application, eventString);
                }
            };

            printWatcher = eventHookFactory.GetPrintWatcher();
            printWatcher.Start();
            printWatcher.OnPrintEvent += (s, e) =>
            {
                string eventString = string.Format("Printer '{0}' currently printing {1} pages.",
                                                   e.EventData.PrinterName, e.EventData.Pages);
                Dispatcher.Invoke(() =>
                {
                    PrinterEvents.Content = eventString;
                });

                if (isRecording)
                {
                    eventWriter.WriteEvent(EventWriter.InputEvent.Print, eventString);
                }
            };

            #endregion

            try
            {
                RegisterChromeExtension();
            } catch (Exception e)
            {
                NotifyIcon.ShowBalloonTip("Exception", e.Message, BalloonIcon.Info);
            }
        }