/// <summary> /// Handles package loading end event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSkipPackage(object sender, MapPackageLoadingEventArgs e) { BeginInvoke(new Action(() => { var item = this.PackageListItems[e.PackageUri]; PackageStatusText.Text = @"Ei löytynyt"; //remove the first item from the source list (ready) Operations.Dequeue(); //process next package LoadPackage(); })); }
/// <summary> /// Handles download progress event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnDownloadPackage(object sender, MapPackageLoadingEventArgs e) { BeginInvoke(new Action(() => { //var item = this.PackageListItems[e.PackageUri]; //item.SetDownloadStatusText(String.Format("{0}/{1} MB", e.DownloadProgress / (1024 * 1024), // e.PackageSize/(1024*1024))); CurrentPackageProgressBar.Value = Math.Min((int)(e.DownloadProgress / 1024), CurrentPackageProgressBar.Maximum); FileStatusText.Text = String.Format("{0:0.0}%", e.DownloadProgress / (double)e.PackageSize * 100); })); }
/// <summary> /// Handles package loading end event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnEndPackage(object sender, MapPackageLoadingEventArgs e) { BeginInvoke(new Action(() => { var item = this.PackageListItems[e.PackageUri]; item.SetStatus(PackageListItem.LoadingStatus.Success); PackageStatusText.Text = "Valmis!"; CurrentPackageProgressBar.Maximum = (int)(e.PackageSize / 1024); //remove the first item from the source list (ready) Operations.Dequeue(); //process next package LoadPackage(); })); }
/// <summary> /// Handles package loading begin download event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void OnBeginPackageDownload(object sender, MapPackageLoadingEventArgs e) { BeginInvoke(new Action(() => { var item = this.PackageListItems[e.PackageUri]; item.SetStatus(PackageListItem.LoadingStatus.Loading); PackageStatusText.Text = "Ladataan karttapaketti palvelusta..."; FileStatusText.Text = e.PackageUri.ToString(); CurrentPackageProgressBar.Maximum = (int)(e.PackageSize / 1024); })); }