private static void UnRegister(View oldElement, AndroidViews.View nativeView)
		{
			nativeView.GenericMotion -= HandleGenericMotion;
			nativeView.Touch -= HandleTouch;

			listener = null;
			detector = null;
		}
		private static void Register(View newElement, AndroidViews.View nativeView)
		{
			listener = new Android_GestureListener(newElement.GestureRecognizers.ToList());
			detector = new AndroidViews.GestureDetector(listener);

			nativeView.GenericMotion += HandleGenericMotion;
			nativeView.Touch += HandleTouch;
		}
Beispiel #3
0
		public static MouseEventArgs ToEto(av.MotionEvent e)
		{
			if (e.Action == av.MotionEventActions.Down)
			{
				return new MouseEventArgs(MouseButtons.Primary, Keys.None, new PointF(e.GetX(), e.GetY()));
			}
			// Is this correct? It generates a mouse event for pointer-up and cancel actions
			// See the iOS handler as well, which does something similar
			return new MouseEventArgs(MouseButtons.Primary, Keys.None, Point.Empty);
		}
		public static void Handle(View newElement, View oldElement, AndroidViews.View nativeView)
		{
			if (newElement != null)
			{
				Register(newElement, nativeView);
			}
			else if (oldElement != null)
			{
				UnRegister(oldElement, nativeView);
			}
		}
Beispiel #5
0
        /// <summary>
        /// If the bindings for the page being loaded are not already cached, then
        /// 
        /// 1) store the page we are on.
        /// 2) convert the xml UI into an element based object model representing the hierarchy and binding information of the UI.
        /// 3) parse the page being loaded by calling the parser and telling it to start. 
        /// 
        /// The parser will create the binding by calling the PageBindingFactory
        /// </summary>
        private void Load(and.View page)
        {
            _currentPage = page;

            //1) get the node tree from the UI markup.
            //ViewBindingParser.Parser();

            //2) get the visitors to visit the node tree.

            throw new System.NotImplementedException();
        }
        /// <summary>
        /// Add a single binding for any page to the list of cached bindings.
        /// </summary>
        /// <param name="viewModel"></param>
        /// <param name="elementId"></param>
        /// <param name="property"></param>
        /// <param name="bindingInfo"></param>
        public void Add(and.View view , Binding binding, IElement element )
        {
            IList<Binding> bindings;
            if(!_perPageBindings.TryGetValue(view, out bindings))
            {
                bindings = new List<Binding>();
                _perPageBindings[view] = bindings;
            }

            bindings.Add(binding);

            binding.Target = _viewModel;
            binding.Source = view;

            var expression = _bindingFactory.Create((ViewModel) binding.Target,
                                                    binding.SourcePath,
                                                    binding.TargetPath,
                                                    binding);
            expression.Element = element;

            _bindingsForCurrentPage.Add(expression);
        }
        /// <summary>
        /// The page that we want to create instances for.
        /// 
        /// 1) freeze or GC old binding instances for the current and soon to be previous page.
        /// 2) generate and cache all of our new bindings
        /// </summary>
        /// <param name="page"></param>
        public void CreateInstancesForPage(and.View page)
        {
            ClearCurrentBindings();

            foreach (var binding in _perPageBindings[page])
            {
                //Add(page, binding);
            }
        }
Beispiel #8
0
		private static Keys Find(av.Keycode key)
		{
			Keys mapped;
			if (keymap.TryGetValue(key, out mapped)) return mapped;
			else return Keys.None;
		}
		private static void HandleGenericMotion(object sender, AndroidViews.View.GenericMotionEventArgs e)
		{
			detector.OnTouchEvent(e.Event);
		}
		private static void HandleTouch(object sender, AndroidViews.View.TouchEventArgs e)
		{
			detector.OnTouchEvent(e.Event);
		}