Ejemplo n.º 1
0
        private static void UpdateColor(Xamarin.Forms.BindableObject bindable, object oldColor, object newColor)
        {
            if (newColor == null || oldColor == null)
            {
                return;
            }

            var oldcolor = (Xamarin.Forms.Color)oldColor;
            var newcolor = (Xamarin.Forms.Color)newColor;



            if (!oldcolor.Equals(newcolor))
            {
                var view            = (CustomCachedImage)bindable;
                var transformations = new System.Collections.Generic.List <FFImageLoading.Work.ITransformation>()
                {
                    new FFImageLoading.Transformations.TintTransformation((int)(newcolor.R * 255), (int)(newcolor.G * 255), (int)(newcolor.B * 255), (int)(newcolor.A * 255))
                    {
                        EnableSolidColor = true
                    }
                };
                view.Transformations = transformations;
            }
        }
 /// <summary>
 /// Invoked when the  HoldingLocation's value has changed
 /// </summary>
 private static void OnHoldingLocationControllerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (e.NewValue is HoldingLocationController)
     {
         ((HoldingLocationController)e.NewValue).SetGeoView(d as GeoView);
     }
 }
 /// <summary>
 /// Invoked when the  ViewPoint value has changed
 /// </summary>
 private async static void OnViewpointChanged(DependencyObject bindable, DependencyPropertyChangedEventArgs e)
 {
     if (e.NewValue is Viewpoint && !(bindable as ViewpointController)._isGeoViewViewpointChangedEventFiring)
     {
         (bindable as ViewpointController)._isOnViewpointChangedExecuting = true;
         await(bindable as ViewpointController)?.GeoView?.SetViewpointAsync((Viewpoint)e.NewValue);
         (bindable as ViewpointController)._isOnViewpointChangedExecuting = false;
     }
 }
        /// <summary>
        /// ViewpointControllerCollection getter method
        /// </summary>
        public static ViewpointControllerCollection GetViewpointControllerCollection(DependencyObject geoView)
        {
            var viewpointControllerCollection = (geoView as GeoView).GetValue(ViewpointControllerCollectionProperty) as ViewpointControllerCollection;

            if (viewpointControllerCollection == null)
            {
                viewpointControllerCollection = new ViewpointControllerCollection();
                SetViewpointControllerCollection(geoView, viewpointControllerCollection);
            }

            return(viewpointControllerCollection);
        }
        /// <summary>
        /// Invoked when the  ViewpointControllerCollection's value has changed
        /// </summary>
        private static void OnViewpointControllerCollectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue is ViewpointControllerCollection collection)
            {
                // Set the initial items in the collection
                foreach (ViewpointController item in collection)
                {
                    item.SetGeoView(d as GeoView);
                }

                // Listen for collection changed, and set the geoview for those new items
                collection.CollectionChanged += (sender, args) =>
                {
                    foreach (ViewpointController item in args.NewItems)
                    {
                        item.SetGeoView(d as GeoView);
                    }
                };
            }
        }
 /// <summary>
 /// ViewpointControllerCollection setter method
 /// </summary>
 public static void SetViewpointControllerCollection(DependencyObject geoView, ViewpointControllerCollection ViewpointControllerCollection)
 {
     (geoView as GeoView)?.SetValue(ViewpointControllerCollectionProperty, ViewpointControllerCollection);
 }
 /// <summary>
 /// HoldingLocationController setter method
 /// </summary>
 public static void SetHoldingLocationController(DependencyObject geoView, HoldingLocationController HoldingLocationController)
 {
     (geoView as GeoView)?.SetValue(HoldingLocationControllerProperty, HoldingLocationController);
 }
 /// <summary>
 /// HoldingLocationController getter method
 /// </summary>
 public static HoldingLocationController GetHoldingLocationController(DependencyObject geoView)
 {
     return((geoView as GeoView)?.GetValue(HoldingLocationControllerProperty) as HoldingLocationController);
 }