Ejemplo n.º 1
0
        public static async Task <Geoposition> GetPosition(uint accuracyInMeters = 0)
        {
            WaitingPanelHelper.ShowWaitingPanel("正在定位,请稍后...", Visibility.Visible);
            bool access = await IsLocationCanAccess();

            if (access)
            {
                //if the Location Premission is Access
                Geolocator locator = new Geolocator()
                {
                    DesiredAccuracy         = PositionAccuracy.Default,
                    DesiredAccuracyInMeters = accuracyInMeters,
                };
                var position = await locator.GetGeopositionAsync();

                WaitingPanelHelper.HiddenWaitingPanel();
                return(position);
            }
            else
            {
                WaitingPanelHelper.HiddenWaitingPanel();
                await new MessageDialog("定位失败! 如有需要,可前往设置打开定位").ShowAsync();
                return(null);
            }
        }
Ejemplo n.º 2
0
        private void BackRequested(object eventArgs)
        {
            if (WaitingPanelHelper.IsWaitingPanelExisted())
            {
                WaitingPanelHelper.HiddenWaitingPanel();

                if (formAction != null)
                {
                    formAction.Absort();
                }
                setArgsHandleTrue(eventArgs);
            }

            var page = CommonHelper.HostPage;

            if (page != null && page.CanGoBack)
            {
                page.GoBack();
                setArgsHandleTrue(eventArgs);
            }
        }