--- a/middleware/Debug/DebugWindow.xaml.cs Thu Apr 05 15:54:44 2012 +0200
+++ b/middleware/Debug/DebugWindow.xaml.cs Thu Apr 05 16:24:40 2012 +0200
@@ -56,6 +56,8 @@
private int takenPoints;
private int directionChangeTresholdXY;
private float directionChangeTresholdZ;
+ //Images
+ private String imgLocation;
//Timer.
private System.Timers.Timer _timer;
@@ -80,6 +82,9 @@
public DebugWindow()//KinectMain main)
{
InitializeComponent();
+
+ imgLocation = "Imgs";
+
//On fait appel au gestionnaire de ressources.
rm = new ResourceManager("Trakers.Debug.Properties.Resources", Assembly.GetExecutingAssembly());
//On tente de charger les paramètres du fichier params.ini.
@@ -610,6 +615,21 @@
}
/*
+ * Permet d'obtenir l'image associée à l'emplacement des images si celle-ci existe.
+ */
+ public Bitmap getImage(String location)
+ {
+ try
+ {
+ return new Bitmap(location);
+ }
+ catch (Exception)
+ {
+ return (Bitmap)rm.GetObject("_404");
+ }
+ }
+
+ /*
* Méthode d'affichage des gestures.
*/
public void showGesture(String gesture)
@@ -623,29 +643,29 @@
//on la convertit et on l'affiche.
switch (gesture)
{
- case "SWIPE-LEFT": bitmap = (Bitmap)rm.GetObject("swipe_left");
+ case "SWIPE-LEFT": bitmap = getImage(imgLocation + "\\swipe_left.png");
break;
- case "SWIPE-RIGHT": bitmap = (Bitmap)rm.GetObject("swipe_right");
+ case "SWIPE-RIGHT": bitmap = getImage(imgLocation + "\\swipe_right.png");
break;
- case "PUSH-RIGHT": bitmap = (Bitmap)rm.GetObject("push_right");
+ case "PUSH-RIGHT": bitmap = getImage(imgLocation + "\\push_right.png");
break;
- case "PUSH-LEFT": bitmap = (Bitmap)rm.GetObject("push_left");
+ case "PUSH-LEFT": bitmap = getImage(imgLocation + "\\push_left.png");
break;
- case "PUSH-BOTH": bitmap = (Bitmap)rm.GetObject("push_both");
+ case "PUSH-BOTH": bitmap = getImage(imgLocation + "\\push_both.png");
break;
- case "PULL-RIGHT": bitmap = (Bitmap)rm.GetObject("pull_right");
+ case "PULL-RIGHT": bitmap = getImage(imgLocation + "\\pull_right.png");
break;
- case "PULL-LEFT": bitmap = (Bitmap)rm.GetObject("pull_left");
+ case "PULL-LEFT": bitmap = getImage(imgLocation + "\\pull_left.png");
break;
- case "PULL-BOTH": bitmap = (Bitmap)rm.GetObject("pull_both");
+ case "PULL-BOTH": bitmap = getImage(imgLocation + "\\pull_both.png");
break;
- case "WAVE": bitmap = (Bitmap)rm.GetObject("wave");
+ case "WAVE": bitmap = getImage(imgLocation + "\\wave.png");
break;
- case "BEND": bitmap = (Bitmap)rm.GetObject("bend");
+ case "BEND": bitmap = getImage(imgLocation + "\\bend.png");
break;
- case "CROSS": bitmap = (Bitmap)rm.GetObject("cross");
+ case "CROSS": bitmap = getImage(imgLocation + "\\cross.png");
break;
- case "KNEE-UP": bitmap = (Bitmap)rm.GetObject("knee_up");
+ case "KNEE-UP": bitmap = getImage(imgLocation + "\\knee_up.png");
break;
}
Gestures.Source = CreateBitmapSourceFromBitmap(bitmap);