コード例 #1
0
        private async void SendMyLocationMessage()
        {
            if (!useLocationService)
            {
                SendErrorMessage(AppResources.LocationServiceAppSettingNotEnabledErrorMessage);
            }
            else
            {
                EnableButtons = false;
                progressNotificationService.ShowProgressMessage(AppResources.RetrievingLocationMessage);

                try
                {
                    GeoCoordinate coordinate = await GetCurrentPosition();

                    if (coordinate != null)
                    {
                        Messenger.Default.Send(new ShowPositionMessage()
                        {
                            Coordinate = coordinate
                        });
                    }
                    else
                    {
                        SendErrorMessage(AppResources.LocationServiceNotEnabledErrorMessage);
                    }
                }
                catch (Exception) { }

                progressNotificationService.StopProgressNotification();
                EnableButtons = true;
            }
        }