Exemplo n.º 1
0
 private async void Posisjon_OnTapped(object sender, EventArgs eventArgs)
 {
     await Navigation.PushModalAsync(
         new PositionPage(VM.CurrentJakt, delegate(PositionPage page)
     {
         VM.CurrentJakt.Latitude = page.VM.LatitudeString;
         VM.CurrentJakt.Longitude = page.VM.LongitudeString;
         VM.Save();
     }));
 }
Exemplo n.º 2
0
        private async Task TryGetPosition()
        {
            var acceptUseGps = await DisplayAlert("Hent posisjon", "Ønsker du å hente posisjon og sted fra GPS?", "Ja", "Nei");

            if (acceptUseGps)
            {
                ToggleLoadPosition();

                var position = await XLabsHelper.GetPosition();

                if (position != null)
                {
                    VM.CurrentJakt.Latitude  = position.Latitude.ToString();
                    VM.CurrentJakt.Longitude = position.Longitude.ToString();

                    var sted = await XLabsHelper.GetLocationNameForPosition(position.Latitude, position.Longitude);

                    if (!string.IsNullOrWhiteSpace(sted))
                    {
                        VM.CurrentJakt.Sted = sted;
                    }

                    VM.Save();
                }

                ToggleLoadPosition();
            }
        }