Пример #1
0
 private async void MapMarker_Tapped(object sender, EventArgs e)
 {
     var marker  = new Xamarin.Essentials.Location(this.cinemaInfo.X, this.cinemaInfo.Y);
     var options = new Xamarin.Essentials.MapLaunchOptions()
     {
         Name           = this.cinemaInfo.Name,
         NavigationMode = Xamarin.Essentials.NavigationMode.None
     };
     await Xamarin.Essentials.Map.OpenAsync(marker, options);
 }
Пример #2
0
        /// <summary>
        /// Starts route navigation to given named point
        /// </summary>
        /// <param name="name">name of point on map to navigate to; may be empty</param>
        /// <param name="point">map point to navigate to</param>
        /// <returns>task to wait on</returns>
        private static async Task NavigateToPointAsync(string name, MapPoint point)
        {
            var navigateLocation = new Xamarin.Essentials.Location(
                latitude: point.Latitude,
                longitude: point.Longitude);

            var options = new Xamarin.Essentials.MapLaunchOptions
            {
                Name           = name,
                NavigationMode = Xamarin.Essentials.NavigationMode.Driving,
            };

            await Xamarin.Essentials.Map.OpenAsync(navigateLocation, options);
        }
Пример #3
0
        /// <summary>
        /// Called when "Navigate here" menu item is selected
        /// </summary>
        /// <returns>task to wait on</returns>
        private async Task OnNavigateToLocationAsync()
        {
            var navigateLocation = new Xamarin.Essentials.Location(
                latitude: this.location.MapLocation.Latitude,
                longitude: this.location.MapLocation.Longitude);

            var options = new Xamarin.Essentials.MapLaunchOptions
            {
                Name           = this.location.Name,
                NavigationMode = Xamarin.Essentials.NavigationMode.Driving,
            };

            await Xamarin.Essentials.Map.OpenAsync(navigateLocation, options);
        }
Пример #4
0
        private async void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            var selectedDrugStore   = (sender as ListView).SelectedItem as Models.DrugStore;
            var faceMaskInDrugStore = DbService.Instance.GetFaceMaskData(selectedDrugStore.DrugStoreId);

            var selectedDrugStoreNote = string.IsNullOrEmpty(selectedDrugStore.Note) ? "" : $"\r\n\r\n備註: {selectedDrugStore.Note}";
            var needNavigation        = await DisplayAlert("資料結果", $"{selectedDrugStore.Name}\r\n\r\n成人口罩剩餘數: { faceMaskInDrugStore.AdultCount}\r\n兒童口罩剩餘數: {faceMaskInDrugStore.ChildCount}{selectedDrugStoreNote}\r\n\r\n來源資料時間: {faceMaskInDrugStore.DataSourceTime}", "導航至藥局", "好,知道了!");

            if (needNavigation)
            {
                var mapLaunchOption = new Xamarin.Essentials.MapLaunchOptions()
                {
                    Name           = selectedDrugStore.Name,
                    NavigationMode = Xamarin.Essentials.NavigationMode.Driving
                };
                await Xamarin.Essentials.Map.OpenAsync(selectedDrugStore.Lat, selectedDrugStore.Lng, mapLaunchOption);
            }

            (sender as ListView).SelectedItem = null;
        }
Пример #5
0
        private async void Pin_Clicked(object sender, EventArgs e)
        {
            var pinPlace = (sender as Pin).BindingContext as Models.Place;

            System.Diagnostics.Debug.WriteLine($"{pinPlace?.DrugStoreId}");

            if (!string.IsNullOrEmpty(pinPlace?.DrugStoreId))
            {
                var faceMaskInDrugStore = Services.DbService.Instance.GetFaceMaskData(pinPlace?.DrugStoreId);

                var selectedPinPlaceNote = string.IsNullOrEmpty(pinPlace.Note) ? "" : $"\r\n\r\n備註: {pinPlace.Note}";
                var needNavigation       = await DisplayAlert("資料結果", $"{pinPlace.Name}\r\n\r\n成人口罩剩餘數: { faceMaskInDrugStore.AdultCount}\r\n兒童口罩剩餘數: {faceMaskInDrugStore.ChildCount}{selectedPinPlaceNote}\r\n\r\n來源資料時間: {faceMaskInDrugStore.DataSourceTime}", "導航至藥局", "好,知道了!");

                if (needNavigation)
                {
                    var mapLaunchOption = new Xamarin.Essentials.MapLaunchOptions()
                    {
                        Name           = pinPlace.Name,
                        NavigationMode = Xamarin.Essentials.NavigationMode.Driving
                    };
                    await Xamarin.Essentials.Map.OpenAsync(pinPlace.Location.Latitude, pinPlace.Location.Longitude, mapLaunchOption);
                }
            }
        }