private void SetCommands() { KeyPress = new RelayCommand <KeyEventArgs>(e => { Log.DebugFormat("Key pressed: {0}", e.Key); if (e.Key == Key.Q) { CloseKinect(); Application.Current.MainWindow.Close(); } else if (e.Key == Key.C) { switch (_kinect.CameraViewType) { case Core.CameraView.Depth: _kinect.CameraViewType = Core.CameraView.ColoredDepth; break; case Core.CameraView.ColoredDepth: _kinect.CameraViewType = Core.CameraView.Color; break; case Core.CameraView.Color: _kinect.CameraViewType = Core.CameraView.None; break; case Core.CameraView.None: _kinect.CameraViewType = Core.CameraView.Depth; break; } SetCameraView(); } else if (e.Key == Key.Up) { WindowMessage = "New ElevationAngle: " + _kinect.MotorUp(2); } else if (e.Key == Key.Down) { WindowMessage = "New ElevationAngle: " + _kinect.MotorDown(2); } else if (e.Key == Key.M) { ToggleMouseControl(); } }); Closing = new RelayCommand <CancelEventArgs>(e => { CloseKinect(); if (_game != null && !_game.HasExited) { _game.Kill(); } Application.Current.Shutdown(); }); StartGame = new RelayCommand <EventArgs>(e => InitStartGame()); }
private void Window_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Space) { this.Close(); } else if (e.Key == Key.Up) { _kinect.MotorUp(2); } else if (e.Key == Key.Down) { _kinect.MotorDown(2); } }
private void SetCommands() { KeyPress = new RelayCommand <KeyEventArgs>(e => { Log.DebugFormat("Key pressed: {0}", e.Key); if (e.Key == Key.S) { SetUpKinect(); } else if (e.Key == Key.D) { ToggleDebugInformation(); } else if (e.Key == Key.Q) { CloseKinect(); SemaphoreGames.Instance.ResetGameCounter(); } else if (e.Key == Key.C) { switch (_kinect.CameraViewType) { case Core.CameraView.Depth: _kinect.CameraViewType = Core.CameraView.ColoredDepth; break; case Core.CameraView.ColoredDepth: _kinect.CameraViewType = Core.CameraView.Color; break; case Core.CameraView.Color: _kinect.CameraViewType = Core.CameraView.None; break; case Core.CameraView.None: _kinect.CameraViewType = Core.CameraView.Depth; break; default: break; } SetCameraView(); } else if (e.Key == Key.Z) { ResizeCameraImage(); } else if (e.Key == Key.Up) { _kinect.MotorUp(2); } else if (e.Key == Key.Down) { _kinect.MotorDown(2); } }); Closing = new RelayCommand <CancelEventArgs>(e => { CloseKinect(); Application.Current.Shutdown(); }); SourceUpdated = new RelayCommand <DataTransferEventArgs>(e => { if (e.TargetObject is ListView) { var lv = e.TargetObject as ListView; lv.ScrollIntoView( lv.Items[lv.Items.Count - 1]); } }); }