public Form1() { InitializeComponent(); controls = new Control[4][] { new Control[] { label1, identifyButton1, orientationTrackBar1, comboBox1, bottomLabel1, selectedMachineLabel1 }, new Control[] { label2, identifyButton2, orientationTrackBar2, comboBox2, bottomLabel2, selectedMachineLabel2 }, new Control[] { label3, identifyButton3, orientationTrackBar3, comboBox3, bottomLabel3, selectedMachineLabel3 }, new Control[] { label4, identifyButton4, orientationTrackBar4, comboBox4, bottomLabel4, selectedMachineLabel4 } }; km.Start(this); }
/// <summary> /// Kinect スタートまたはストップ /// </summary> public void StartOrStopKinect() { try { if (!_kinectManager.Started) { _kinectManager.Initialize(); try { _kinectManager.Start(); } catch (Exception) { _kinectManager.Terminate(); throw; } _originPositionAutoSetter.AddEventListenerTo(_kinectManager); _originPositionAutoSetter.Update += new EventHandler <EventArgs>(_originPositionAutoSetter_Update); _kinectDataManager.AddEventListenerTo(_kinectManager); _kinectManager.ColorUpdate += new EventHandler <ColorUpdateEventArgs>(_kinectManager_ColorUpdate); _kinectManager.DepthUpdate += new EventHandler <DepthUpdateEventArgs>(_kinectManager_DepthUpdate); _kinectManager.SkeletonUpdate += new EventHandler <SkeletonUpdateEventArgs>(_kinectManager_SkeletonUpdate); StatusBarMessage = "実行中"; } else { _kinectManager.SkeletonUpdate -= _kinectManager_SkeletonUpdate; _kinectManager.DepthUpdate -= _kinectManager_DepthUpdate; _kinectManager.ColorUpdate -= _kinectManager_ColorUpdate; _kinectDataManager.RemoveEventListenerTo(_kinectManager); _originPositionAutoSetter.RemoveEventListenerTo(_kinectManager); _kinectManager.Stop(); _kinectManager.Terminate(); StatusBarMessage = ""; } } catch (Exception e) { StatusBarMessage = e.Message; } RaisePropertyChanged("KinectStartOrStopButtonLabel"); RaisePropertyChanged("OriginPositionAutoSetInfo"); SetOriginPositionCommand.RaiseCanExecuteChanged(); ApplyKinectElevationAngleCommand.RaiseCanExecuteChanged(); }
public MainWindow() { InitializeComponent(); this.Closed += ClosedWindow; kinectManager = new KinectManager(); kinectManager.Start(); bodyManager = new BodyManager(kinectManager); speechRecognitionManager = new SpeechRecognitionManager(kinectManager.Sensor); speechRecognitionManager.RecognizedCommandEventHandler += RecognizedCommand; mainPanel.CommandEventHandler += MainPanelCommand; trainPanel.KinectManager = kinectManager; trainPanel.BodyManager = bodyManager; exercisePanel.KinectManager = kinectManager; exercisePanel.BodyManager = bodyManager; focusedPanel = FocusedPanel.Main; }