コード例 #1
0
ファイル: Home.xaml.cs プロジェクト: davidvasquezr/ABMeter
        public Home()
        {
            CustomNavigationPage.SetTitleMargin(this, new Thickness(0, 0, 0, 0));
            InitializeComponent();

            map.MyLocationEnabled = true;
            map.UiSettings.MyLocationButtonEnabled = true;

            //Sets the title position to end
            CustomNavigationPage.SetTitlePosition(this, CustomNavigationPage.TitleAlignment.Center);

            //Sets shadow for bar bottom
            CustomNavigationPage.SetHasShadow(this, true);

            //Sets the title text font to Micro
            CustomNavigationPage.SetTitleFont(this, Font.SystemFontOfSize(NamedSize.Large));

            //Sets the title color
            CustomNavigationPage.SetTitleColor(this, Color.White);

            //Sets bar background opacity
            //CustomNavigationPage.SetBarBackgroundOpacity(this, 0.6f);

            CustomNavigationPage.SetGradientColors(this, new Tuple <Color, Color>(Color.FromHex("#00838f"), Color.FromHex("#00838f")));
            //CustomNavigationPage.SetGradientColors(this, new Tuple<Color, Color>(Color.FromHex("#00838f"), Color.FromHex("#4fb3bf")));
            CustomNavigationPage.SetGradientDirection(this, CustomNavigationPage.GradientDirection.LeftToRight);

            // Map Long clicked
            map.MapLongClicked += (sender, e) =>
            {
                var lat = e.Point.Latitude.ToString("0.000000");
                var lng = e.Point.Longitude.ToString("0.000000");
                //this.DisplayAlert("MapLongClicked", $"{lat}/{lng}", "CLOSE");
                latDestino.Text = lat;
                lonDestino.Text = lng;

                var pin = new Pin()
                {
                    Label    = "Destino",
                    Position = new Position(e.Point.Latitude, e.Point.Longitude)
                };

                map.Pins.Clear();
                map.Pins.Add(pin);
            };

            //Device.StartTimer(TimeSpan.FromSeconds(1), () =>
            //{
            //    // Do something
            //    CalculateLocation();

            //    return llego; // True = Repeat again, False = Stop the timer
            //});
        }