コード例 #1
0
        public MainPageViewModel()
        {
            DidFinishRenderingCommand = new Command((obj) =>
            {
                if (_IsScaleBarShown == false && CenterLocation != null)
                {
                    _IsScaleBarShown = ToggleScaleBarFunc?.Invoke(true) ?? false;
                    System.Diagnostics.Debug.WriteLine("Did toggle scale bar");
                    //UpdateViewPortAction?.Invoke(new Position(CenterLocation.Lat + 0.001, CenterLocation.Long + 0.001), 16, null, false, () => {
                    //	System.Diagnostics.Debug.WriteLine("Did update center location");
                    //});
                }
                if (forcedRegion != null)
                {
                    UpdateViewPortAction?.Invoke(
                        new Position()
                    {
                        Lat  = forcedRegion.Bounds.SouthWest.Lat / 2 + forcedRegion.Bounds.NorthEast.Lat / 2,
                        Long = forcedRegion.Bounds.SouthWest.Long / 2 + forcedRegion.Bounds.NorthEast.Long / 2
                    },
                        forcedRegion.MaximumZoomLevel / 2 + forcedRegion.MinimumZoomLevel / 2,
                        null,
                        true,
                        null
                        );
                    forcedRegion = null;
                }
            }, (arg) => true);


            offlineService = DependencyService.Get <IOfflineStorageService>();
            offlineService.OfflinePackProgressChanged += (sender, e) =>
            {
                var   progress   = e.OfflinePack.Progress;
                float percentage = 0;
                if (progress.CountOfResourcesExpected > 0)
                {
                    percentage = (float)progress.CountOfResourcesCompleted / progress.CountOfResourcesExpected;
                }
                System.Diagnostics.Debug.WriteLine($"Downloaded resources: {progress.CountOfResourcesCompleted} ({percentage * 100} %)");
                System.Diagnostics.Debug.WriteLine($"Downloaded tiles: {progress.CountOfTilesCompleted}");
                if (progress.CountOfResourcesExpected == progress.CountOfResourcesCompleted)
                {
                    System.Diagnostics.Debug.WriteLine("Download completed");
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        UserDialogs.Instance.HideLoading();
                    });
                }
            };
        }
コード例 #2
0
 public MainPageViewModel()
 {
     DidFinishRenderingCommand = new Command((obj) =>
     {
         if (_IsScaleBarShown == false && CenterLocation != null)
         {
             _IsScaleBarShown = ToggleScaleBarFunc?.Invoke(true) ?? false;
             System.Diagnostics.Debug.WriteLine("Did toggle scale bar");
             //UpdateViewPortAction?.Invoke(new Position(CenterLocation.Lat + 0.001, CenterLocation.Long + 0.001), 16, null, false, () => {
             //	System.Diagnostics.Debug.WriteLine("Did update center location");
             //});
         }
     }, (arg) => true);
 }
コード例 #3
0
        public MapLocationPageViewModel()
        {
            DidFinishRenderingCommand = new Command((obj) =>
            {
                if (_isScaleBarShown == false && CenterLocation != null)
                {
                    _isScaleBarShown = ToggleScaleBarFunc?.Invoke(true) ?? false;
                    System.Diagnostics.Debug.WriteLine("Did toggle scale bar");
                }
            }, (arg) => true);


            ZoomLevel = 5.17159761572925;
        }