Esempio n. 1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            Debug.WriteLine("searching for process..");

            Process[] prc = Process.GetProcessesByName(PROCESS_NAME);

            // attach to process if possible
            if (prc.Length == 0)
            {
                Debug.WriteLine("No process with name " + PROCESS_NAME + " wasn't found. ", "FAILURE");
            }
            else
            {
                this.WorkingProcess = prc.First<Process>();
                Debug.WriteLine("attached to process " + this.WorkingProcess.ProcessName + "!", "SUCCESS");
                this.WorkingProcess.EnableRaisingEvents = true;
                this.WorkingProcess.Exited += WorkingProcess_Exited;

                // Start camera
                this._camera = new Camera(this.onFiredGesture);
                this._camera.Start();
            }
        }
Esempio n. 2
0
        void WorkingProcess_Exited(object sender, EventArgs e)
        {
            Debug.WriteLine("working process exited!");

            // Stop the streaming
            this._camera.Stop();
            this._camera = null;
        }