Exemplo n.º 1
0
        /// <summary>
        /// for each pin, return the related view (userControl or whatever)
        /// </summary>
        /// <returns>The pin view.</returns>
        /// <param name="pin">Pin.</param>
        View GetPinView(WPin pin)
        {
            var pinView = new S1PinView();

            pinView.Price = pin.Atts ["Price"].ToString();
            return(pinView);
        }
Exemplo n.º 2
0
        /// <summary>
        /// for each pin, return the related window (userControl or whatever)
        /// </summary>
        /// <returns>The window view.</returns>
        /// <param name="pin">Pin.</param>
        View GetWindowView(WPin pin)
        {
            var window = new S1Window(pin);

            window.ImageLoaded += delegate(object sender, WPin e) {
                Map.RefreshWindowForPin(pin);
            };
            window.ImageUrl    = pin.Atts ["ImageUrl"].ToString();
            window.Title       = pin.Pin.Label;
            window.Description = pin.Atts ["Description"].ToString();
            return(window);
        }
Exemplo n.º 3
0
        public S1Window(WPin pin)
        {
            InitializeComponent();
            this.Pin = pin;


            this.IvImage.Success += delegate(object sender, FFImageLoading.Forms.CachedImageEvents.SuccessEventArgs e) {
                if (this.ImageLoaded != null)
                {
                    this.ImageLoaded(this, this.Pin);
                }
            };
        }
Exemplo n.º 4
0
        public Android.Views.View GetInfoContents(Marker marker)
        {
            var pin = GetPin(marker);

            if (pin == null)
            {
                throw new Exception("Custom pin not found");
            }

            if (pin.Atts == null)
            {
                pin.Atts = new Dictionary <string, object> ();
            }

            pin.Atts ["Marker"] = marker;

            if (this.MapControl.GetPinWindowDelegate == null)
            {
                return(new Android.Views.View(this.Context));
            }

            Android.Views.View view;
            object             nativeView;

            WeakReference <object> windowInfo = null;

            if (pin.Atts.ContainsKey("windowInfo"))
            {
                windowInfo = pin.Atts["windowInfo"] as WeakReference <object>;
            }
            if (windowInfo == null || !windowInfo.TryGetTarget(out nativeView))
            {
                var formsView = this.MapControl.GetPinWindowDelegate(pin);
                view                   = WMapAuxiliarRenderer.LiveMapRenderer.GetNativeView(formsView);
                windowInfo             = new WeakReference <object> (view);
                pin.Atts["windowInfo"] = windowInfo;
            }
            else
            {
                view = (Android.Views.View)nativeView;
            }

            CurrentPinWindow = pin;

            return(view);
        }
Exemplo n.º 5
0
 void RefreshWindow(WPin pin)
 {
     Device.BeginInvokeOnMainThread(delegate()
     {
         try
         {
             var marker = pin.Atts["Marker"] as Marker;
             if (CurrentPinWindow == pin)
             {
                 marker.HideInfoWindow();
                 marker.ShowInfoWindow();
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.Message);
         }
     });
 }
Exemplo n.º 6
0
 protected void Map_RendererNeedToRefreshWindow(object sender, WPin e)
 {
     Task.Delay(500).ContinueWith(delegate(Task arg) {
         RefreshWindow(e);
     });
 }
Exemplo n.º 7
0
 void OnInfoWindowClose(object sender, GoogleMap.InfoWindowCloseEventArgs e)
 {
     CurrentPinWindow = null;
 }
Exemplo n.º 8
0
        void LoadPins()
        {
            WPin pin;

            pin = new WPin {
                Pin = new Pin {
                    Type     = PinType.Place,
                    Position = new Position(-34.6013, -58.3795),
                    Label    = "Javo"
                },
                Id = "1",
                // on the attributes, put the info you need to customize your pin/window
                Atts = new Dictionary <string, object> {
                    { "ImageUrl", "http://fmhvibe.co.uk/community/uploads/b095eb4e9b8fae5afef6fa79a509a1ab.jpg" },
                    { "Description", "Mi nombre es Javo !!" },
                    { "Price", 25 }
                }
            };
            Map.AddPin(pin);

            pin = new WPin {
                Pin = new Pin {
                    Type     = PinType.Place,
                    Position = new Position(-34.603412, -58.377493),
                    Label    = "Maradona"
                },
                Id   = "2",
                Atts = new Dictionary <string, object> {
                    { "ImageUrl", "https://julian095.files.wordpress.com/2010/03/16563maradona411mf11.jpeg" },
                    { "Description", "Mi nombre es Maradona !!" },
                    { "Price", 12 }
                }
            };
            Map.AddPin(pin);

            pin = new WPin {
                Pin = new Pin {
                    Type     = PinType.Place,
                    Position = new Position(-34.603439, -58.387557),
                    Label    = "Messi"
                },
                Id   = "3",
                Atts = new Dictionary <string, object> {
                    { "ImageUrl", "https://www.occrp.org/assets/panamapapers/persons/messi.png" },
                    { "Description", "Mi nombre es Messi !!" },
                    { "Price", 89 }
                }
            };
            Map.AddPin(pin);

            pin = new WPin {
                Pin = new Pin {
                    Type     = PinType.Place,
                    Position = new Position(-34.610480, -58.384539),
                    Label    = "Pele"
                },
                Id   = "4",
                Atts = new Dictionary <string, object> {
                    { "ImageUrl", "http://www.fourfourtwo.hu/admin/ckfinder/userfiles/images/Pele%20nagy.jpg" },
                    { "Description", "Mi nombre es Pele !!" },
                    { "Price", 76 }
                }
            };
            Map.AddPin(pin);
        }
Exemplo n.º 9
0
 void Map_WindowClicked(object sender, WPin e)
 {
     DisplayAlert("Clicked", e.Pin.Label, "Ok");
 }