/// <summary>
 /// 破棄処理
 /// </summary>
 private void Uninitialize()
 {
     if (this.SensorModel != null)
     {
         this.SensorModel.PropertyChanged -= this.Model_PropertyChanged;
         this.SensorModel = null;
     }
 }
        /// <summary>
        /// 初期化
        /// </summary>
        private void Initialize()
        {
            this.SensorModel = RealSenseSensorModel.Instance;
            this.SensorModel.PropertyChanged += this.Model_PropertyChanged;

            this.Canvas = new Canvas();

            //顔を囲う矩形の初期化
            this.faceRects = new Rectangle[RealSenseSensorModel.DETECTION_MAXFACES];
            for (int i = 0; i < RealSenseSensorModel.DETECTION_MAXFACES; i++)
            {
                this.faceRects[i] = new Rectangle();
                TranslateTransform transform = new TranslateTransform(RealSenseSensorModel.COLOR_WIDTH, RealSenseSensorModel.COLOR_HEIGHT);
                this.faceRects[i].Width = 0;
                this.faceRects[i].Height = 0;
                this.faceRects[i].Stroke = Brushes.Blue;
                this.faceRects[i].StrokeThickness = 3;
                this.faceRects[i].RenderTransform = transform;
                this.Canvas.Children.Add(this.faceRects[i]);
            }
            //顔のランドマークポイントの初期化
            this.facePoints = new Ellipse[RealSenseSensorModel.LANDMARK_MAXFACES, 78];
            for (int i = 0; i < RealSenseSensorModel.LANDMARK_MAXFACES; i++)
            {
                for (int j = 0; j < 78; j++)
                {
                    this.facePoints[i, j] = new Ellipse();
                    this.facePoints[i, j].Width = 1;
                    this.facePoints[i, j].Height = 1;
                    this.facePoints[i, j].Fill = new SolidColorBrush(Colors.Red);
                    this.Canvas.Children.Add(this.facePoints[i, j]);
                }
            }
            //ガイドラインの初期化
            this.guidelines = new Dictionary<GuidelineType, Line>[RealSenseSensorModel.LANDMARK_MAXFACES];
            for (int i = 0; i < RealSenseSensorModel.LANDMARK_MAXFACES; i++)
            {
                this.guidelines[i] = new Dictionary<GuidelineType, Line>();
                foreach (GuidelineType guideline in Enum.GetValues(typeof(GuidelineType)))
                {
                    var line = new Line();
                    line.Stroke = Brushes.White;
                    line.X1 = 0;
                    line.Y1 = 0;
                    line.X2 = 0;
                    line.Y2 = 0;
                    this.guidelines[i].Add(guideline, line);
                    this.Canvas.Children.Add(line);
                }
            }
            //判定結果表示テキストの初期化
            this.resultText = new TextBlock[RealSenseSensorModel.LANDMARK_MAXFACES];
            for (int i = 0; i < RealSenseSensorModel.LANDMARK_MAXFACES; i++)
            {
                this.resultText[i] = new TextBlock();
                this.resultText[i].Width = 200;
                this.resultText[i].Height = 32;
                this.resultText[i].Foreground = Brushes.Magenta;
                this.resultText[i].FontSize = 20;
                this.Canvas.Children.Add(this.resultText[i]);
            }
        }