/// <summary>
 /// 定位
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private async void OrientationCmd_Clicked(object sender, EventArgs e)
 {
     using (UserDialogs.Instance.Loading("定位中...", cancelText: "取消"))
     {
         map.ZoomLevel = 19;
         await _locationService?.UpdateCenter(map);
     }
 }
Exemple #2
0
 /// <summary>
 /// 恢复当前位置
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private async void FixedPosition_Clicked(object sender, EventArgs e)
 {
     try
     {
         if (map != null)
         {
             using (UserDialogs.Instance.Loading("定位中...", cancelText: "取消"))
             {
                 map.ZoomLevel = 19;
                 await _locationService?.UpdateCenter(map);
             }
         }
     }
     catch (Exception)
     { }
 }
 void TryRun()
 {
     try
     {
         Task.Run(async() =>
         {
             if (_locationService != null)
             {
                 if (map != null)
                 {
                     await _locationService.UpdateCenter(map);
                 }
             }
         });
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.Print(ex.Message);
     }
 }
        /// <summary>
        /// 重新定位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ReceiveLocationCommand_Clicked(object sender, EventArgs e)
        {
            using (UserDialogs.Instance.Loading("定位中...", cancelText: "取消"))
            {
                try
                {
                    if (map != null)
                    {
                        if (ViewModel != null)
                        {
                            ((ICommand)ViewModel.Load)?.Execute(null);
                        }

                        map.ZoomLevel = 19;
                        await _locationService?.UpdateCenter(map);
                    }
                }
                catch (Exception ex)
                {
                    Crashes.TrackError(ex);
                }
            }
        }