middleware/src/Debug/DebugWindow.xaml.cs
changeset 5 d40f84d77db4
parent 3 92f19af39024
child 6 93dfb08dcc97
--- a/middleware/src/Debug/DebugWindow.xaml.cs	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Debug/DebugWindow.xaml.cs	Mon Mar 19 10:21:56 2012 +0100
@@ -33,11 +33,15 @@
 using System.Threading;
 using Trakers.Tracking.Events;
 using Trakers.Tracking.Gestures;
+using System.Resources;
+using System.Reflection;
 
 namespace Trakers.Debug
 {
     public partial class DebugWindow : Window
     {
+        //Gestionnaire de ressources.
+        private ResourceManager rm;
         //Membre permettant d'atteindre la classe KinectMain du sous-module Tracking.
         private KinectMain kinectMain;
         //Tableau contenant une image en couleurs.
@@ -54,6 +58,7 @@
         */
         public DebugWindow(KinectMain main)
         {
+            rm = new ResourceManager("Trakers.Properties.resources", Assembly.GetExecutingAssembly());
             InitializeComponent();
             kinectMain = main;
             on = false;
@@ -144,6 +149,9 @@
             //Si on a des données dans le tableau et que la kinect est allumée.
             if (receivedData && on)
             {
+                //Exemples de modifications de l'affichage :
+                //Zombies apocalypse.
+                //Black & White movie.
                 /*for (int i = 0; i < colorPixelData.Length; i += colorImageFrameData.BytesPerPixel)
                 {
                     byte gray = Math.Min(colorPixelData[i], colorPixelData[i + 1]);
@@ -172,12 +180,7 @@
         {
             DistanceLbl.Content = "Distance : " + distance;
 
-            /*R1.Fill = System.Windows.Media.Brushes.Transparent;
-            R2.Fill = System.Windows.Media.Brushes.Transparent;
-            R3.Fill = System.Windows.Media.Brushes.Transparent;
-            R4.Fill = System.Windows.Media.Brushes.Transparent;*/
-
-            /*if (distance > 0 && distance < 1)
+            if (distance > 0 && distance < 1)
             {
                 R1.Fill = System.Windows.Media.Brushes.Red;
                 R2.Fill = System.Windows.Media.Brushes.DarkGray;
@@ -204,7 +207,7 @@
                 R2.Fill = System.Windows.Media.Brushes.DarkGray;
                 R3.Fill = System.Windows.Media.Brushes.DarkGray;
                 R4.Fill = System.Windows.Media.Brushes.White;
-            }*/
+            }
         }
 
         /*
@@ -362,5 +365,33 @@
                 }
             }
         }
+
+        /*
+         * Méthode associée à l'événement : Ouvrir la fenêtre de paramétrage via le menu.
+         */
+        private void Parameters_Click(object sender, RoutedEventArgs e)
+        {
+            DebugParameters param = new DebugParameters(kinectMain);
+
+            try
+            {
+                param.ShowDialog();
+            }
+            catch (Exception)
+            {
+                ExceptionLbl.Content = rm.GetString("loadParamFail");
+            }
+        }
+
+        /*
+         * Méthode associée à l'événement : Quitter via le menu.
+         */
+        private void Quit_Click(object sender, RoutedEventArgs e)
+        {
+            closing = true;
+            //On éteint la Kinect (pour éviter qu'elle reste allumée même lorsque le programme est éteint).
+            kinectMain.KinectClose();
+            Application.Current.Shutdown();
+        }
     }
 }