middleware/Debug/DebugWindow.xaml.cs
changeset 56 7d0ae2f385e7
parent 54 eb52a12370a3
child 57 d0c393730443
--- a/middleware/Debug/DebugWindow.xaml.cs	Thu Jul 26 14:34:02 2012 +0200
+++ b/middleware/Debug/DebugWindow.xaml.cs	Thu Jul 26 17:44:35 2012 +0200
@@ -85,15 +85,26 @@
             //On charge les éléments relatifs au projet.
             if (projectName.Equals("TraKERS"))
             {
+                MiddlewareDebugWindow.Title = "TraKERS - Middleware";
                 configPath = ".\\TraKERS - config.txt";
                 loadTraKERSMenu();
             }
             else if (projectName.Equals("BBM"))
             {
+                MiddlewareDebugWindow.Title = "Browse by Motion - Middleware";
                 configPath = ".\\BBM - config.txt";
                 loadBBMMenu();
             }
 
+            //On initialise les images des mains.
+            Bitmap rightHandBitmap = getImage(imgLocation + "\\right_hand_off.png"), leftHandBitmap = getImage(imgLocation + "\\left_hand_off.png");
+            LeftHand.Source = CreateBitmapSourceFromBitmap(leftHandBitmap);
+            RightHand.Source = CreateBitmapSourceFromBitmap(rightHandBitmap);
+            //On initialise les images de proximité.
+            Bitmap userBitmap = getImage(imgLocation + "\\user.png"), kinectBitmap = getImage(imgLocation + "\\kinect.png");
+            UserImage.Source = CreateBitmapSourceFromBitmap(userBitmap);
+            KinectImage.Source = CreateBitmapSourceFromBitmap(kinectBitmap);
+
             //On tente de charger les paramètres du fichier params.ini.
             //Si on n'y arrive pas, on affiche une erreur et on charge les paramètres par défaut.
             if (!loadParameters())
@@ -199,6 +210,7 @@
 
             //On cache la partie du menu des readme et doc de BBM.
             DocumentationFrontIDILLMenu.Visibility = Visibility.Collapsed;
+            FrontIDILLMenu.Visibility = Visibility.Collapsed;
 
             //Readme et doc de TraKERS.
             ReadmeFrontProcessingMenu.Header = rm.GetString("menuReadmeFrontProcessing");
@@ -348,16 +360,9 @@
             {
                 //Il affiche ON (pour allumer la kinect).
                 Switch.Content = "ON";
-                //On remet à zéro tous les éléments du retour visuel.
-                R1.Fill = System.Windows.Media.Brushes.DarkGray;
-                R2.Fill = System.Windows.Media.Brushes.DarkGray;
-                R3.Fill = System.Windows.Media.Brushes.DarkGray;
-                R4.Fill = System.Windows.Media.Brushes.DarkGray;
-                DistanceLbl.Content = "Distance :";
-                LeftHand.Background = System.Windows.Media.Brushes.DarkGray;
-                LeftHand.Content = "";
-                RightHand.Background = System.Windows.Media.Brushes.DarkGray;
-                RightHand.Content = "";
+                Bitmap rightHandBitmap = getImage(imgLocation + "\\right_hand_off.png"), leftHandBitmap = getImage(imgLocation + "\\left_hand_off.png");
+                LeftHand.Source = CreateBitmapSourceFromBitmap(leftHandBitmap);
+                RightHand.Source = CreateBitmapSourceFromBitmap(rightHandBitmap);
                 DebugCanvas.Children.RemoveRange(1, DebugCanvas.Children.Count - 1);
             }
         }
@@ -414,176 +419,7 @@
         */
         public void showDistance(float proximity)
         {
-            DistanceLbl.Content = "Proximity : " + proximity + "%";
-
-            if (proximity == 0)
-            {
-                R0.Fill = System.Windows.Media.Brushes.DarkGray;
-                R1.Fill = System.Windows.Media.Brushes.DarkGray;
-                R2.Fill = System.Windows.Media.Brushes.DarkGray;
-                R3.Fill = System.Windows.Media.Brushes.DarkGray;
-                R4.Fill = System.Windows.Media.Brushes.DarkGray;
-                R5.Fill = System.Windows.Media.Brushes.DarkGray;
-                R6.Fill = System.Windows.Media.Brushes.DarkGray;
-                R7.Fill = System.Windows.Media.Brushes.DarkGray;
-                R8.Fill = System.Windows.Media.Brushes.DarkGray;
-                R9.Fill = System.Windows.Media.Brushes.DarkGray;
-                R10.Fill = System.Windows.Media.Brushes.DarkGray;
-            }
-            else if (proximity > 0 && proximity < 10)
-            {
-                R0.Fill = System.Windows.Media.Brushes.DarkGray;
-                R1.Fill = System.Windows.Media.Brushes.DarkGray;
-                R2.Fill = System.Windows.Media.Brushes.DarkGray;
-                R3.Fill = System.Windows.Media.Brushes.DarkGray;
-                R4.Fill = System.Windows.Media.Brushes.DarkGray;
-                R5.Fill = System.Windows.Media.Brushes.DarkGray;
-                R6.Fill = System.Windows.Media.Brushes.DarkGray;
-                R7.Fill = System.Windows.Media.Brushes.DarkGray;
-                R8.Fill = System.Windows.Media.Brushes.DarkGray;
-                R9.Fill = System.Windows.Media.Brushes.DarkGray;
-                R10.Fill = System.Windows.Media.Brushes.Red;
-            }
-            else if (proximity > 10 && proximity < 20)
-            {
-                R0.Fill = System.Windows.Media.Brushes.DarkGray;
-                R1.Fill = System.Windows.Media.Brushes.DarkGray;
-                R2.Fill = System.Windows.Media.Brushes.DarkGray;
-                R3.Fill = System.Windows.Media.Brushes.DarkGray;
-                R4.Fill = System.Windows.Media.Brushes.DarkGray;
-                R5.Fill = System.Windows.Media.Brushes.DarkGray;
-                R6.Fill = System.Windows.Media.Brushes.DarkGray;
-                R7.Fill = System.Windows.Media.Brushes.DarkGray;
-                R8.Fill = System.Windows.Media.Brushes.DarkGray;
-                R9.Fill = System.Windows.Media.Brushes.Red;
-                R10.Fill = System.Windows.Media.Brushes.Red;
-            }
-            else if (proximity > 20 && proximity < 30)
-            {
-                R0.Fill = System.Windows.Media.Brushes.DarkGray;
-                R1.Fill = System.Windows.Media.Brushes.DarkGray;
-                R2.Fill = System.Windows.Media.Brushes.DarkGray;
-                R3.Fill = System.Windows.Media.Brushes.DarkGray;
-                R4.Fill = System.Windows.Media.Brushes.DarkGray;
-                R5.Fill = System.Windows.Media.Brushes.DarkGray;
-                R6.Fill = System.Windows.Media.Brushes.DarkGray;
-                R7.Fill = System.Windows.Media.Brushes.DarkGray;
-                R8.Fill = System.Windows.Media.Brushes.Red;
-                R9.Fill = System.Windows.Media.Brushes.Red;
-                R10.Fill = System.Windows.Media.Brushes.Red;
-            }
-            else if (proximity > 30 && proximity < 40)
-            {
-                R0.Fill = System.Windows.Media.Brushes.DarkGray;
-                R1.Fill = System.Windows.Media.Brushes.DarkGray;
-                R2.Fill = System.Windows.Media.Brushes.DarkGray;
-                R3.Fill = System.Windows.Media.Brushes.DarkGray;
-                R4.Fill = System.Windows.Media.Brushes.DarkGray;
-                R5.Fill = System.Windows.Media.Brushes.DarkGray;
-                R6.Fill = System.Windows.Media.Brushes.DarkGray;
-                R7.Fill = System.Windows.Media.Brushes.Orange;
-                R8.Fill = System.Windows.Media.Brushes.Red;
-                R9.Fill = System.Windows.Media.Brushes.Red;
-                R10.Fill = System.Windows.Media.Brushes.Red;
-            }
-            else if (proximity > 40 && proximity < 50)
-            {
-                R0.Fill = System.Windows.Media.Brushes.DarkGray;
-                R1.Fill = System.Windows.Media.Brushes.DarkGray;
-                R2.Fill = System.Windows.Media.Brushes.DarkGray;
-                R3.Fill = System.Windows.Media.Brushes.DarkGray;
-                R4.Fill = System.Windows.Media.Brushes.DarkGray;
-                R5.Fill = System.Windows.Media.Brushes.DarkGray;
-                R6.Fill = System.Windows.Media.Brushes.Orange;
-                R7.Fill = System.Windows.Media.Brushes.Orange;
-                R8.Fill = System.Windows.Media.Brushes.Red;
-                R9.Fill = System.Windows.Media.Brushes.Red;
-                R10.Fill = System.Windows.Media.Brushes.Red;
-            }
-            else if (proximity > 50 && proximity < 60)
-            {
-                R0.Fill = System.Windows.Media.Brushes.DarkGray;
-                R1.Fill = System.Windows.Media.Brushes.DarkGray;
-                R2.Fill = System.Windows.Media.Brushes.DarkGray;
-                R3.Fill = System.Windows.Media.Brushes.DarkGray;
-                R4.Fill = System.Windows.Media.Brushes.DarkGray;
-                R5.Fill = System.Windows.Media.Brushes.Orange;
-                R6.Fill = System.Windows.Media.Brushes.Orange;
-                R7.Fill = System.Windows.Media.Brushes.Orange;
-                R8.Fill = System.Windows.Media.Brushes.Red;
-                R9.Fill = System.Windows.Media.Brushes.Red;
-                R10.Fill = System.Windows.Media.Brushes.Red;
-            }
-            else if (proximity > 60 && proximity < 70)
-            {
-                R0.Fill = System.Windows.Media.Brushes.DarkGray;
-                R1.Fill = System.Windows.Media.Brushes.DarkGray;
-                R2.Fill = System.Windows.Media.Brushes.DarkGray;
-                R3.Fill = System.Windows.Media.Brushes.DarkGray;
-                R4.Fill = System.Windows.Media.Brushes.Yellow;
-                R5.Fill = System.Windows.Media.Brushes.Orange;
-                R6.Fill = System.Windows.Media.Brushes.Orange;
-                R7.Fill = System.Windows.Media.Brushes.Orange;
-                R8.Fill = System.Windows.Media.Brushes.Red;
-                R9.Fill = System.Windows.Media.Brushes.Red;
-                R10.Fill = System.Windows.Media.Brushes.Red;
-            }
-            else if (proximity > 70 && proximity < 80)
-            {
-                R0.Fill = System.Windows.Media.Brushes.DarkGray;
-                R1.Fill = System.Windows.Media.Brushes.DarkGray;
-                R2.Fill = System.Windows.Media.Brushes.DarkGray;
-                R3.Fill = System.Windows.Media.Brushes.Yellow;
-                R4.Fill = System.Windows.Media.Brushes.Yellow;
-                R5.Fill = System.Windows.Media.Brushes.Orange;
-                R6.Fill = System.Windows.Media.Brushes.Orange;
-                R7.Fill = System.Windows.Media.Brushes.Orange;
-                R8.Fill = System.Windows.Media.Brushes.Red;
-                R9.Fill = System.Windows.Media.Brushes.Red;
-                R10.Fill = System.Windows.Media.Brushes.Red;
-            }
-            else if (proximity > 80 && proximity < 90)
-            {
-                R0.Fill = System.Windows.Media.Brushes.DarkGray;
-                R1.Fill = System.Windows.Media.Brushes.DarkGray;
-                R2.Fill = System.Windows.Media.Brushes.Yellow;
-                R3.Fill = System.Windows.Media.Brushes.Yellow;
-                R4.Fill = System.Windows.Media.Brushes.Yellow;
-                R5.Fill = System.Windows.Media.Brushes.Orange;
-                R6.Fill = System.Windows.Media.Brushes.Orange;
-                R7.Fill = System.Windows.Media.Brushes.Orange;
-                R8.Fill = System.Windows.Media.Brushes.Red;
-                R9.Fill = System.Windows.Media.Brushes.Red;
-                R10.Fill = System.Windows.Media.Brushes.Red;
-            }
-            else if (proximity > 90 && proximity < 100)
-            {
-                R0.Fill = System.Windows.Media.Brushes.DarkGray;
-                R1.Fill = System.Windows.Media.Brushes.Yellow;
-                R2.Fill = System.Windows.Media.Brushes.Yellow;
-                R3.Fill = System.Windows.Media.Brushes.Yellow;
-                R4.Fill = System.Windows.Media.Brushes.Yellow;
-                R5.Fill = System.Windows.Media.Brushes.Orange;
-                R6.Fill = System.Windows.Media.Brushes.Orange;
-                R7.Fill = System.Windows.Media.Brushes.Orange;
-                R8.Fill = System.Windows.Media.Brushes.Red;
-                R9.Fill = System.Windows.Media.Brushes.Red;
-                R10.Fill = System.Windows.Media.Brushes.Red;
-            }
-            else if (proximity == 100)
-            {
-                R0.Fill = System.Windows.Media.Brushes.Green;
-                R1.Fill = System.Windows.Media.Brushes.Yellow;
-                R2.Fill = System.Windows.Media.Brushes.Yellow;
-                R3.Fill = System.Windows.Media.Brushes.Yellow;
-                R4.Fill = System.Windows.Media.Brushes.Yellow;
-                R5.Fill = System.Windows.Media.Brushes.Orange;
-                R6.Fill = System.Windows.Media.Brushes.Orange;
-                R7.Fill = System.Windows.Media.Brushes.Orange;
-                R8.Fill = System.Windows.Media.Brushes.Red;
-                R9.Fill = System.Windows.Media.Brushes.Red;
-                R10.Fill = System.Windows.Media.Brushes.Red;
-            }
+            UserImage.Margin = new System.Windows.Thickness(552, 350 - 350 / 100 * proximity, 0, 0);
         }
 
         /*
@@ -591,10 +427,14 @@
         */
         public void showRightHandRect(bool show)
         {
+            Bitmap bitmap = null;
+
             if (show)
-                RightHand.Background = System.Windows.Media.Brushes.Blue;
+                bitmap = getImage(imgLocation + "\\right_hand_on.png");
             else
-                RightHand.Background = System.Windows.Media.Brushes.DarkGray;
+                bitmap = getImage(imgLocation + "\\right_hand_off.png");
+
+            RightHand.Source = CreateBitmapSourceFromBitmap(bitmap);
         }
 
         /*
@@ -602,10 +442,14 @@
         */
         public void showLeftHandRect(bool show)
         {
+            Bitmap bitmap = null;
+
             if (show)
-                LeftHand.Background = System.Windows.Media.Brushes.Blue;
+                bitmap = getImage(imgLocation + "\\left_hand_on.png");
             else
-                LeftHand.Background = System.Windows.Media.Brushes.DarkGray;
+                bitmap = getImage(imgLocation + "\\left_hand_off.png");
+
+            LeftHand.Source = CreateBitmapSourceFromBitmap(bitmap);
         }
 
         /*
@@ -703,18 +547,6 @@
             //On vide le canvas mais en gardant l'image.
             if(DebugCanvas.Children.Count > 1)
                 DebugCanvas.Children.RemoveRange(1, DebugCanvas.Children.Count - 1);
-            //On colore en gris tous les indicateurs.
-            R0.Fill = System.Windows.Media.Brushes.DarkGray;
-            R1.Fill = System.Windows.Media.Brushes.DarkGray;
-            R2.Fill = System.Windows.Media.Brushes.DarkGray;
-            R3.Fill = System.Windows.Media.Brushes.DarkGray;
-            R4.Fill = System.Windows.Media.Brushes.DarkGray;
-            R5.Fill = System.Windows.Media.Brushes.DarkGray;
-            R6.Fill = System.Windows.Media.Brushes.DarkGray;
-            R7.Fill = System.Windows.Media.Brushes.DarkGray;
-            R8.Fill = System.Windows.Media.Brushes.DarkGray;
-            R9.Fill = System.Windows.Media.Brushes.DarkGray;
-            R10.Fill = System.Windows.Media.Brushes.DarkGray;
         }
 
         /*
@@ -722,7 +554,7 @@
         */
         public void showLeftHandCoord(String coord)
         {
-            LeftHand.Content = coord;
+            //LeftHand.Content = coord;
         }
 
         /*
@@ -730,7 +562,7 @@
         */
         public void showRightHandCoord(String coord)
         {
-            RightHand.Content = coord;
+            //RightHand.Content = coord;
         }
 
         /*