コード例 #1
0
        internal static IVisualElementRenderer CreateRenderer(VisualElement element)
        {
            IVisualElementRenderer renderer = Forms.GetHandlerForObject <IVisualElementRenderer>(element) ?? new DefaultRenderer();

            renderer.SetElement(element);
            return(renderer);
        }
コード例 #2
0
 GestureHandler CreateHandler(IGestureRecognizer recognizer)
 {
     if (recognizer is TapGestureRecognizer)
     {
         return(new TapGestureHandler(recognizer));
     }
     else if (recognizer is PinchGestureRecognizer)
     {
         return(new PinchGestureHandler(recognizer));
     }
     else if (recognizer is PanGestureRecognizer)
     {
         return(new PanGestureHandler(recognizer));
     }
     else if (recognizer is SwipeGestureRecognizer)
     {
         return(new SwipeGestureHandler(recognizer));
     }
     else if (recognizer is DragGestureRecognizer)
     {
         return(new DragGestureHandler(recognizer, _renderer));
     }
     else if (recognizer is DropGestureRecognizer)
     {
         return(new DropGestureHandler(recognizer, _renderer));
     }
     return(Forms.GetHandlerForObject <GestureHandler>(recognizer, recognizer));
 }
コード例 #3
0
        public static async Task <bool> LoadFromImageSourceAsync(this EImage image, ImageSource source)
        {
            IImageSourceHandler handler;
            bool isLoadComplate = false;

            if (source != null && (handler = Forms.GetHandlerForObject <IImageSourceHandler>(source)) != null)
            {
                isLoadComplate = await handler.LoadImageAsync(image, source);
            }
            if (!isLoadComplate)
            {
                //If it fails, call the Load function to remove the previous image.
                image.Load(string.Empty);
            }

            return(isLoadComplate);
        }
コード例 #4
0
 GestureHandler CreateHandler(IGestureRecognizer recognizer)
 {
     return(Forms.GetHandlerForObject <GestureHandler>(recognizer, recognizer));
 }