コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: ZeyuW/eecs481maze
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (KinectSensor.KinectSensors.Count > 0)
            {
                this.sensor = KinectSensor.KinectSensors[0];

				if (this.sensor.Status == KinectStatus.Connected)
				{
					Image[] codes = new Image[] { _0_code, _1_code, _2_code, _3_code, _4_code, };
					foreach (Image i in codes)
					{
						i.Visibility = Visibility.Hidden;
					}
                    _0_code.Visibility = Visibility.Visible;
					calController = new CalibrationController(sensor, kinectController, drawingCanvas, codes, image1);
					calController.CalibrationDidComplete += new CalibrationController.calibrationDidCompleteHandler(calibrationCompleted);
					//sensor.AllFramesReady += kinectController.SensorAllFramesReady;
					//calibrationCompleted();
                    
                    this.sensor.AllFramesReady += calController.DisplayColorImageAllFramesReady;
					this.sensor.ColorStream.Enable();
					this.sensor.DepthStream.Enable();
                    //this.sensor.ColorStream.CameraSettings.Contrast = 2.0;

                    Console.WriteLine("abc");

                    this.sensor.Start();
				}
            }

            this.KeyDown += new KeyEventHandler(OnKeyDown);
            this.MouseDown += new MouseButtonEventHandler(OnClick);
            this.MouseDoubleClick += new MouseButtonEventHandler(OnDoubleClick);
            soundController.StartMusic();
            drawController.ChangeBackground();
            drawController.ChangeColor(Colors.Red);

            foreach (Ellipse ellipse in buttons)
            {
                ellipse.Visibility = Visibility.Hidden;
            }

            
        }
コード例 #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (KinectSensor.KinectSensors.Count > 0)
            {
                this.sensor = KinectSensor.KinectSensors[0];

                if (this.sensor.Status == KinectStatus.Connected)
                {
                    Image[] codes = new Image[] { _0_code, _1_code, _2_code, _3_code, _4_code, };
                    foreach (Image i in codes)
                    {
                        i.Visibility = Visibility.Hidden;
                    }
                    _0_code.Visibility = Visibility.Visible;
                    calController      = new CalibrationController(sensor, kinectController, drawingCanvas, codes, image1);
                    calController.CalibrationDidComplete += new CalibrationController.calibrationDidCompleteHandler(calibrationCompleted);
                    //sensor.AllFramesReady += kinectController.SensorAllFramesReady;
                    //calibrationCompleted();

                    this.sensor.AllFramesReady += calController.DisplayColorImageAllFramesReady;
                    this.sensor.ColorStream.Enable();
                    this.sensor.DepthStream.Enable();
                    //this.sensor.ColorStream.CameraSettings.Contrast = 2.0;

                    Console.WriteLine("abc");

                    this.sensor.Start();
                }
            }

            this.KeyDown          += new KeyEventHandler(OnKeyDown);
            this.MouseDown        += new MouseButtonEventHandler(OnClick);
            this.MouseDoubleClick += new MouseButtonEventHandler(OnDoubleClick);
            soundController.StartMusic();
            drawController.ChangeBackground();
            drawController.ChangeColor(Colors.Red);

            foreach (Ellipse ellipse in buttons)
            {
                ellipse.Visibility = Visibility.Hidden;
            }
        }