Beispiel #1
0
        public void RunGesture(List<string> xmlContents, GesturePlaybackCompleted playbackCompleted = null)
        {
            List<GestureInfo> gestures = new List<GestureInfo>();
            foreach (string xml in xmlContents)
            {
                GestureInfo gestureInfo = SerializationHelper.Desirialize(xml);
                gestures.Add(gestureInfo);
            }

            GestureInfo merged = gestures.Merge();
            RunGesture(merged, playbackCompleted);
        }
Beispiel #2
0
        /// <summary>
        /// Simulates the touch(s) as specified in the xml
        /// </summary>
        /// <param name="xml">XML serialized collection of FrameInfo objects</param>
        public void RunGesture(string xml, GesturePlaybackCompleted playbackCompleted = null)
        {
            GestureInfo gestureInfo = SerializationHelper.Desirialize(xml);

            RunGesture(gestureInfo, playbackCompleted);
        }
Beispiel #3
0
        private void RunGesture(GestureInfo gestureInfo, GesturePlaybackCompleted playbackCompleted)
        {
            // Set touch provider to virtual touch provider
            var existingInputProvider = TouchInputManager.ActiveTouchProvider;
            GestureFramework.UpdateInputProvider(_touchListener);

            // Initializing background thread to playback recorded gestures
            var threadStart = new ParameterizedThreadStart(RunGesture);
            var backgroundThread = new Thread(threadStart);

            Tuple<GestureInfo, TouchInputRecorder.GesturePlaybackCompleted> args =
                new Tuple<GestureInfo, TouchInputRecorder.GesturePlaybackCompleted>(gestureInfo, playbackCompleted);

            backgroundThread.Start(args);

            // reset touch provider
            GestureFramework.UpdateInputProvider(existingInputProvider);
        }