middleware/src/MainModule/Events/PushListener.cs
changeset 15 4b78f179e7ce
child 17 fda26bfcabef
equal deleted inserted replaced
14:10d5199d9874 15:4b78f179e7ce
       
     1 /*
       
     2 * This file is part of the TraKERS\Middleware package.
       
     3 *
       
     4 * (c) IRI <http://www.iri.centrepompidou.fr/>
       
     5 *
       
     6 * For the full copyright and license information, please view the LICENSE_MIDDLEWARE
       
     7 * file that was distributed with this source code.
       
     8 */
       
     9 
       
    10 /*
       
    11  * Projet : TraKERS
       
    12  * Module : MIDDLEWARE
       
    13  * Sous-Module : MainModule/Events
       
    14  * Classe : PushListener
       
    15  * 
       
    16  * Auteur : alexandre.bastien@iri.centrepompidou.fr
       
    17  * 
       
    18  * Fonctionnalités : Ce listener écoute l'événement du type : L'utilisateur a effectué un push.
       
    19  * Il contient le code a être éxecuté au cas où cet événement survient.
       
    20  */
       
    21 
       
    22 using System;
       
    23 using System.Collections.Generic;
       
    24 using System.Linq;
       
    25 using System.Text;
       
    26 
       
    27 namespace Trakers.MainModule.Events
       
    28 {
       
    29     public class PushListener
       
    30     {
       
    31         /*
       
    32         * Méthode appelée lorsque on a l'événement : L'utilisateur a effectué un push.
       
    33         */
       
    34         public void showAndSend(object o, PushEventArgs e)
       
    35         {
       
    36             //On l'indique dans le debug.
       
    37             //Lorsqu'il s'agit d'un push/pull de la main gauche/droite/deux deux on envoie le message
       
    38             //correspondant.
       
    39             String code = "";
       
    40             if (e.direction == Gestures.PushDetector.Direction.PUSH)
       
    41             {
       
    42                 if (e.hand == Gestures.PushDetector.Hand.RIGHT)
       
    43                     code = "PUSH-RIGHT";
       
    44                 else if (e.hand == Gestures.PushDetector.Hand.LEFT)
       
    45                     code = "PUSH-LEFT";
       
    46                 else
       
    47                     code = "PUSH-BOTH";
       
    48             }
       
    49             else
       
    50             {
       
    51                 if (e.hand == Gestures.PushDetector.Hand.RIGHT)
       
    52                     code = "PULL-RIGHT";
       
    53                 else if (e.hand == Gestures.PushDetector.Hand.LEFT)
       
    54                     code = "PULL-LEFT";
       
    55                 else
       
    56                     code = "PULL-BOTH";
       
    57             }
       
    58             
       
    59             e.debug.showGesture(code);
       
    60             e.server.GesturePerformed(code);
       
    61         }
       
    62     }
       
    63 }