//verifie et supprime les doublons de la map
 public void verifierDoublonsOnMap(HoverButton zone)
 {
     nbreLabelplace = 0;
     foreach (HoverButton zoneText in listZoneDepot)
     {
         if ((zoneText.Name != zone.Name) && (zoneText.Text == zone.Text))
         {
             zoneText.Text = "";
             zoneText.Opacity = 0;
         }
         if (zoneText.Text != "")
         {
             nbreLabelplace++;
             TextRenvoyePourLabelPlace();
         }
     }
 }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     
     #line 5 "..\..\..\MainWindow.xaml"
     ((TestControls.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);
     
     #line default
     #line hidden
     
     #line 5 "..\..\..\MainWindow.xaml"
     ((TestControls.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);
     
     #line default
     #line hidden
     return;
     case 2:
     this.kinectCanvas = ((System.Windows.Controls.Canvas)(target));
     return;
     case 3:
     this.ConteneurLogTextBox = ((System.Windows.Controls.TextBox)(target));
     return;
     case 4:
     this.LogTextBox = ((System.Windows.Controls.TextBox)(target));
     return;
     case 5:
     this.VillesTextBox = ((System.Windows.Controls.TextBox)(target));
     return;
     case 6:
     this.ZonePoubelle = ((KinectControls.HoverButton)(target));
     return;
     case 7:
     this.image20 = ((System.Windows.Controls.Image)(target));
     return;
     case 8:
     this.sonVent = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 9:
     this.sonIntroduction = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 10:
     this.sonCorrectionImpossible = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 11:
     this.sonCorrectionEffectuee = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 12:
     this.sonMiseAZero = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 13:
     this.sonDebutDeJeu = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 14:
     this.sonToutesLesVillesPlacees = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 15:
     this.textBoxInfoVille = ((System.Windows.Controls.TextBox)(target));
     return;
     case 16:
     this.zoneDefilementBoutonVille = ((KinectControls.HoverButton)(target));
     return;
     case 17:
     this.border1 = ((System.Windows.Controls.Border)(target));
     return;
     case 18:
     this.image19 = ((System.Windows.Controls.Image)(target));
     return;
     case 19:
     this.image10 = ((System.Windows.Controls.Image)(target));
     return;
     case 20:
     this.image11 = ((System.Windows.Controls.Image)(target));
     return;
     case 21:
     this.image12 = ((System.Windows.Controls.Image)(target));
     return;
     case 22:
     this.image13 = ((System.Windows.Controls.Image)(target));
     return;
     case 23:
     this.image14 = ((System.Windows.Controls.Image)(target));
     return;
     case 24:
     this.image15 = ((System.Windows.Controls.Image)(target));
     return;
     case 25:
     this.image16 = ((System.Windows.Controls.Image)(target));
     return;
     case 26:
     this.image17 = ((System.Windows.Controls.Image)(target));
     return;
     case 27:
     this.image18 = ((System.Windows.Controls.Image)(target));
     return;
     case 28:
     this.image1 = ((System.Windows.Controls.Image)(target));
     return;
     case 29:
     this.image2 = ((System.Windows.Controls.Image)(target));
     return;
     case 30:
     this.zoneLille = ((KinectControls.HoverButton)(target));
     return;
     case 31:
     this.image3 = ((System.Windows.Controls.Image)(target));
     return;
     case 32:
     this.zoneRennes = ((KinectControls.HoverButton)(target));
     return;
     case 33:
     this.image4 = ((System.Windows.Controls.Image)(target));
     return;
     case 34:
     this.zoneParis = ((KinectControls.HoverButton)(target));
     return;
     case 35:
     this.image5 = ((System.Windows.Controls.Image)(target));
     return;
     case 36:
     this.zoneNancy = ((KinectControls.HoverButton)(target));
     return;
     case 37:
     this.image6 = ((System.Windows.Controls.Image)(target));
     return;
     case 38:
     this.zoneNantes = ((KinectControls.HoverButton)(target));
     return;
     case 39:
     this.image7 = ((System.Windows.Controls.Image)(target));
     return;
     case 40:
     this.zoneOrléans = ((KinectControls.HoverButton)(target));
     return;
     case 41:
     this.image8 = ((System.Windows.Controls.Image)(target));
     return;
     case 42:
     this.zoneBordeaux = ((KinectControls.HoverButton)(target));
     return;
     case 43:
     this.image9 = ((System.Windows.Controls.Image)(target));
     return;
     case 44:
     this.zoneLyon = ((KinectControls.HoverButton)(target));
     return;
     case 45:
     this.image100 = ((System.Windows.Controls.Image)(target));
     return;
     case 46:
     this.zoneToulouse = ((KinectControls.HoverButton)(target));
     return;
     case 47:
     this.image101 = ((System.Windows.Controls.Image)(target));
     return;
     case 48:
     this.zoneAix = ((KinectControls.HoverButton)(target));
     return;
     case 49:
     this.btn1 = ((KinectControls.HoverButton)(target));
     return;
     case 50:
     this.suivant = ((KinectControls.HoverButton)(target));
     return;
     case 51:
     this.precedent = ((KinectControls.HoverButton)(target));
     return;
     case 52:
     this.hand = ((KinectControls.HandCursor)(target));
     
     #line 88 "..\..\..\MainWindow.xaml"
     this.hand.Loaded += new System.Windows.RoutedEventHandler(this.hand_Loaded);
     
     #line default
     #line hidden
     return;
     case 53:
     this.aixMarseilleLogo = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 54:
     this.Lille1Logo = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 55:
     this.NancyLogo = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 56:
     this.Paris5Logo = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 57:
     this.OrleansLogo = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 58:
     this.RennesLogo = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 59:
     this.NantesLogo = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 60:
     this.BordeauxLogo = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 61:
     this.ToulouseLogo = ((System.Windows.Controls.MediaElement)(target));
     return;
     case 62:
     this.LyonLogo = ((System.Windows.Controls.MediaElement)(target));
     return;
     }
     this._contentLoaded = true;
 }
        void ProcessFrame(ReplaySkeletonFrame frame)
        {
            foreach(var skeleton in frame.Skeletons)
            {
                if(skeleton.TrackingState != SkeletonTrackingState.Tracked)
                    continue;

                barycenterHelper.Add(skeleton.Position.ToVector3(), skeleton.TrackingId);

                if(!barycenterHelper.IsStable(skeleton.TrackingId))
                    return;

                foreach(Joint joint in skeleton.Joints)
                {
                    if(joint.TrackingState != JointTrackingState.Tracked)
                        continue;

                    int positionInit = villes.getPositionElement("paris");

                     if (joint.JointType == JointType.HandRight)
                     {
                        sonDebutDeJeu.LoadedBehavior = MediaState.Play;
                        int positionVilleDansTableau = villes.getPositionElement();
                        swipeGestureReconnaissance.Add(joint.Position, kinectSensor);
                        hand.SetPosition(joint);

                        if (btn1.Check(hand))
                        {
                            Console.WriteLine("la main est dans la zone de droite et sur le bouton principal");

                            if (swipefronttoback)
                            {
                                btn1.BackgroundColor = Brushes.Chocolate;
                                btn1.SetPosition(joint);

                            }

                        }

                        if (swipebacktofront)
                        {
                           // zone.BackgroundColor = Brushes.CadetBlue;
                            zone.Opacity = 1;
                            zone.Text = btn1.Text;
                            zone.TextColor = Brushes.Black;
                            BoutonPositionInitial();

                            lesZonesDepots.verifierDoublonsOnMap(zone);
                            if (lesZonesDepots.reponse().Equals("Maintenant que les villes sont placées. Vous pouvez demander la correction"))
                            {
                                sonToutesLesVillesPlacees.Position = new TimeSpan(0);
                                sonToutesLesVillesPlacees.LoadedBehavior = MediaState.Play;
                            }
                            swipefronttoback = false;
                            swipebacktofront = false;
                        }

                        if (ZonePoubelle.Check(hand))
                        {
                            BoutonPositionInitial();
                            swipefronttoback = false;

                        }
                        if (zoneDefilementBoutonVille.Check(hand))//si la main est dans la zone de droite avec les boutons
                        {

                            if (swipebottom)
                            {
                                sonVent.Position = new TimeSpan(0);
                                sonVent.LoadedBehavior = MediaState.Play;

                                suivant.Text = btn1.Text;
                                btn1.Text = precedent.Text;
                                precedent.Text = villes.recupererNomVille(btn1.Text, "next");
                                informationMiageVille();
                                Console.WriteLine("main droite defilement vers le bas");

                                swipebottom = false;
                            }

                        }

                    }

                     if (joint.JointType == JointType.HandLeft)
                     {
                         mainGauche = true;
                         jointMainGauche = joint;
                         Console.WriteLine("main gauche trouvée");

                     }
                     if (joint.JointType == JointType.Head)
                     {
                         tete = true;
                         jointTete = joint;
                         Console.WriteLine("tete trouvée");
                     }
                     Console.WriteLine("coucou");
                     zone = GetZone();
                     if (tete && mainGauche && zone!= null && zone.Check(hand) && btn1.Check(hand))
                     {
                         Console.WriteLine("Main + tete trouvée");
                         if (jointMainGauche.Position.Y > jointTete.Position.Y)
                         {
                             BoutonPositionInitial();
                             Console.WriteLine("Main gauche au dessus de tete");

                             //zone.BackgroundColor = Brushes.CadetBlue;
                             zone.Opacity = 1;
                             zone.Text = btn1.Text;
                             swipefronttoback = false;
                             zone.TextColor = Brushes.Black;

                            lesZonesDepots.verifierDoublonsOnMap(zone);
                            if (lesZonesDepots.reponse().Equals("Maintenant que les villes sont placées. Vous pouvez demander la correction"))
                            {
                                sonToutesLesVillesPlacees.Position = new TimeSpan(0);
                                sonToutesLesVillesPlacees.LoadedBehavior = MediaState.Play;
                            }
                         }
                         tete = false;
                         mainGauche = false;
                    }

                }

             }
        }
        void OnGestureDetected(string gesture)
        {
            if (gesture.Equals("SwipeUp"))
            {
                swipeup = true;
                Console.WriteLine("swipe defilement vers le haut");
            }

            if (gesture.Equals("SwipeBottom"))
            {
                swipebottom = true;
                Console.WriteLine("swipe defilement vers le bas");
            }

                if (gesture.Equals("SwipeBackFront"))
                {
                     if (GetZone()!=null)//Vérifie si le bouton peut etre deposable sur la zone
                    {
                        zone = GetZone();
                        swipebacktofront = true;
                        Console.WriteLine("swipe back front");
                    }

                }

                if (gesture.Equals("SwipeFrontBack"))
                {
                    if (btn1.Check(hand))
                    {
                        swipefronttoback = true;
                    }
                    Console.WriteLine("swipe front back");
                }
        }