Example #1
0
        public void addTouchMove(int id, Point pos)
        {
           // Debug.Assert(screenHandPoints.ContainsKey(id));
            if (screenHandPoints.ContainsKey(id))
            {
                
                HandPoint hp = new HandPoint(id, pos, screenHandPoints[id].HandId);
                this.behaviorLog.addLog(LogType.TouchMove, pos, id, hp.HandId);
            }
            else
            {
                //MessageBox.Show("move not in");
                Console.WriteLine("detect a non-existing touch");
            }

        }
Example #2
0
 public void addTouchDown(int id, Point pos)
 {
    // Debug.Assert(!screenHandPoints.ContainsKey(id));
     if (!screenHandPoints.ContainsKey(id))
     {
         
         Config.handIdCount++;
         HandPoint hp = new HandPoint(id, pos, Config.handIdCount);
         this.behaviorLog.addLog(LogType.TouchDown, pos, id, hp.HandId);
         screenHandPoints.Add(id, hp);
     } else
     {
         //MessageBox.Show("down already in");
         Console.WriteLine("add an existing touch");
     }
     
 }
Example #3
0
 public void addTouchUp(int id, Point pos)
 {
     //Debug.Assert(screenHandPoints.ContainsKey(id));
     if (screenHandPoints.ContainsKey(id))
     {
                         
         HandPoint startHp = screenHandPoints[id];
         HandPoint hp = new HandPoint(id, pos, startHp.HandId);
         this.behaviorLog.addLog(LogType.TouchUp, pos, id, hp.HandId);
         screenHandPoints.Remove(id);
         if (hp.isSwapLeft(startHp))
         {
             //左滑删除
             //this.keyboard.delete();
         }
         else if (hp.isSwapRight(startHp))
         {
             //this.keyboard.select(0);
         }
         else
         {
             if (!hp.isValidateTouch(startHp))
             {
                 //MessageBox.Show("1");
                 //手歇在屏幕上
                 return;
             }
             else
             {
                 //MessageBox.Show("2");
                 //是一次有效的点击
                 //MessageBox.Show(String.Format("{0},{1}", pos.X,pos.Y));
                 this.keyboard.touchDown(pos, id, hp.HandId);
                 this.keyboard.touchUp(pos, id, hp.HandId);
                 this.window.task.startTask();
             }
         }
     } else
     {
         //MessageBox.Show("up not in");
         Console.WriteLine("detect a non-existing touch");
     }
 }
Example #4
0
 public bool isSwapRight(HandPoint startHp)
 {
     return ((this.pos.X - startHp.pos.X > 50) && (Math.Abs(this.pos.Y - startHp.pos.Y) < 20));
 }
Example #5
0
 public bool isValidateTouch(HandPoint startHp)
 {
   //  Console.WriteLine("RestTime:" + ((this.time - startHp.time).ToString()));
     return ((this.time - startHp.time) < 350);
 }