Exemplo n.º 1
0
        internal static IntPtr CreateInteractionContext(IInteractionHandler interactionHandler, SynchronizationContext syncContext)
        {
            IntPtr ic;

            CreateInteractionContext(out ic);
            InteractionOutput io = new InteractionOutput(ic, interactionHandler, syncContext);

            lock (_lockObj)
            {
                _listeners.Add(ic.ToInt64(), io);
            }
            RegisterOutputCallbackInteractionContext(ic, Marshal.GetFunctionPointerForDelegate(_callback), ic);
            return(ic);
        }
Exemplo n.º 2
0
        internal override void ProcessEvent(InteractionOutput output)
        {
            if (output.Data.Interaction == Win32TouchFunctions.INTERACTION.TAP)
            {
                var p = touchForm.PointToClient(new System.Drawing.Point((int)output.Data.X, (int)output.Data.Y));

                if (output.Data.Tap.Count == 1)
                {
                    touchForm.NotifyTap(new Vector2(p.X, p.Y));
                }
                else if (output.Data.Tap.Count == 2)
                {
                    touchForm.NotifyDoubleTap(new Vector2(p.X, p.Y));
                }
            }
            else if (output.Data.Interaction == Win32TouchFunctions.INTERACTION.SECONDARY_TAP)
            {
                var p = touchForm.PointToClient(new System.Drawing.Point((int)output.Data.X, (int)output.Data.Y));

                touchForm.NotifyTouchSecondaryTap(new Vector2(p.X, p.Y));
            }
            else if (output.Data.Interaction == Win32TouchFunctions.INTERACTION.HOLD)
            {
            }
            else if (output.Data.Interaction == Win32TouchFunctions.INTERACTION.MANIPULATION)
            {
                if (output.IsBegin())
                {
                    var p = touchForm.PointToClient(new System.Drawing.Point((int)output.Data.X, (int)output.Data.Y));
                    center          = new Vector2(p.X, p.Y);
                    prevTranslation = new Vector2();
                    return;
                }

                var mt = output.Data.Manipulation.Cumulative;

                var translation = new Vector2(mt.TranslationX, mt.TranslationY);

                var delta = translation - prevTranslation;

                prevTranslation = translation;


                touchForm.NotifyTouchManipulation(center, delta, mt.Scale);

                //output.IsEnd()
            }
        }
Exemplo n.º 3
0
        internal override void ProcessEvent(InteractionOutput output)
        {
            if (output.Data.Interaction == Win32TouchFunctions.INTERACTION.TAP) {
	            
				var p = touchForm.PointToClient(new System.Drawing.Point((int)output.Data.X, (int)output.Data.Y));

	            if (output.Data.Tap.Count == 1) {
					touchForm.NotifyTap(new Vector2(p.X, p.Y));
	            } 
				else if (output.Data.Tap.Count == 2) {
					touchForm.NotifyDoubleTap(new Vector2(p.X, p.Y));
                }
            }
            else if (output.Data.Interaction == Win32TouchFunctions.INTERACTION.SECONDARY_TAP)
            {
				var p = touchForm.PointToClient(new System.Drawing.Point((int)output.Data.X, (int)output.Data.Y));

				touchForm.NotifyTouchSecondaryTap(new Vector2(p.X, p.Y));
            }
			else if (output.Data.Interaction == Win32TouchFunctions.INTERACTION.HOLD) {
				
			}
			else if (output.Data.Interaction == Win32TouchFunctions.INTERACTION.MANIPULATION) {
				if (output.IsBegin()) {
					var p	= touchForm.PointToClient(new System.Drawing.Point((int)output.Data.X, (int)output.Data.Y));
					center	= new Vector2(p.X, p.Y);
					prevTranslation = new Vector2();
					return;
				}

				var mt = output.Data.Manipulation.Cumulative;

				var translation = new Vector2(mt.TranslationX, mt.TranslationY);

				var delta = translation - prevTranslation;

				prevTranslation = translation;


				touchForm.NotifyTouchManipulation(center, delta, mt.Scale);

				//output.IsEnd()
			}
        }
Exemplo n.º 4
0
 static void TimerElapsed(object state)
 {
     InteractionOutput[] items = null;
     lock (_lockObj)
     {
         if (_inertiaQueue.Count > 0)
         {
             items = _inertiaQueue.ToArray();
             _inertiaQueue.Clear();
         }
     }
     if (items != null)
     {
         for (int i = 0; i < items.Length; i++)
         {
             InteractionOutput io = items[i];
             for (int j = 0; j < i; j++)
             {
                 if (items[j].InteractionContext == io.InteractionContext)
                 {
                     io = null;
                     break;
                 }
             }
             if (io != null && io.Alive)
             {
                 io.SyncContext.Post(delegate(object obj)
                 {
                     InteractionOutput m = (InteractionOutput)obj;
                     if (m.Alive)
                     {
                         ProcessInertiaInteractionContext(m.InteractionContext);
                     }
                 }, io);
             }
         }
     }
 }
Exemplo n.º 5
0
 internal abstract void ProcessEvent(InteractionOutput output);
Exemplo n.º 6
0
 void IInteractionHandler.ProcessInteractionEvent(InteractionOutput output)
 {
     ProcessEvent(output);
 }
Exemplo n.º 7
0
 internal static IntPtr CreateInteractionContext(IInteractionHandler interactionHandler, SynchronizationContext syncContext)
 {
     IntPtr ic;
     CreateInteractionContext(out ic);
     InteractionOutput io = new InteractionOutput(ic, interactionHandler, syncContext);
     lock (_lockObj)
     {
         _listeners.Add(ic.ToInt64(), io);
     }
     RegisterOutputCallbackInteractionContext(ic, Marshal.GetFunctionPointerForDelegate(_callback), ic);
     return ic;
 }
Exemplo n.º 8
0
 void IInteractionHandler.ProcessInteractionEvent(InteractionOutput output)
 {
     ProcessEvent(output);
 }
Exemplo n.º 9
0
 internal abstract void ProcessEvent(InteractionOutput output);