void recordEnded(object sender, EventArgs e) { Console.WriteLine("process end"); if (pipeServer != null) { pipeServer.Close(); pipeServer = null; } this.Dispatcher.Invoke((Action)(() => { switchPlane(); })); p = null; }
private void btnStartRecording_Click(object sender, RoutedEventArgs e) { var startInfo = new ProcessStartInfo(@"C:\Anaconda\python.exe", @"C:\molocker\src\screen_lock.py -s -n " + Environment.UserName); startInfo.WorkingDirectory = @"C:\molocker\src"; startInfo.WindowStyle = ProcessWindowStyle.Hidden; pipeServer = new PipeServer(); pipeServer.Listen("molocker_record"); pipeServer.PipeMessage += pipeServer_PipeMessage; ShowDialog("Connecting to Leap Motion...", "molocker"); AllowUIToUpdate(); p = new Process(); p.StartInfo = startInfo; p.EnableRaisingEvents = true; p.Exited += recordEnded; p.Start(); }