public void updateProgress(PowerpointImportProgress progress)
 {
     this.Dispatcher.adopt(delegate {
         progressBar.Maximum = progress.totalSlides;
         progressBar.Value = progress.slideId;
         progressLabel.Content = progress.stage.ToString();
         if (progress.stage == PowerpointImportProgress.IMPORT_STAGE.ANALYSED)
         {
             progressBarContainer.Visibility = Visibility.Collapsed;
         } else {
             progressBarContainer.Visibility = Visibility.Visible;
         }
     });
 }
 private void UpdatePowerpointProgress(PowerpointImportProgress progress)
 {
     Dispatcher.adopt(delegate
     {
         switch (progress.stage)
         {
             case PowerpointImportProgress.IMPORT_STAGE.DESCRIBED:
                 reset();
                 Visibility = Visibility.Visible;
                 setContent("Importing");
                 this.progress.IsIndeterminate = true;
                 break;
             case PowerpointImportProgress.IMPORT_STAGE.EXTRACTED_IMAGES:
                 slidesExtracted++;
                 setContent("Processing");
                 setProgress((slidesAnalyzed + slidesExtracted) / Convert.ToDouble(progress.totalSlides * 2) * 100);
                 break;
             case PowerpointImportProgress.IMPORT_STAGE.ANALYSED:
                 slidesAnalyzed++;
                 setContent("Loading");
                 setProgress((slidesAnalyzed + slidesExtracted) / Convert.ToDouble(progress.totalSlides * 2) * 100);
                 break;
             case PowerpointImportProgress.IMPORT_STAGE.UPLOADED_RESOURCES:
                 slidesAnalyzed++;
                 setContent("Loading");
                 setProgress((slidesAnalyzed + slidesExtracted) / Convert.ToDouble(progress.totalSlides * 2) * 100);
                 break;
             case PowerpointImportProgress.IMPORT_STAGE.UPLOADED_XML:
                 slidesAnalyzed++;
                 setContent("Loading");
                 setProgress((slidesAnalyzed + slidesExtracted) / Convert.ToDouble(progress.totalSlides * 2) * 100);
                 break;
             case PowerpointImportProgress.IMPORT_STAGE.FINISHED:
                 slidesAnalyzed++;
                 setContent("Complete");
                 setProgress((slidesAnalyzed + slidesExtracted) / Convert.ToDouble(progress.totalSlides * 2) * 100);
                 break;
             case PowerpointImportProgress.IMPORT_STAGE.PRINTING:
                 slidesAnalyzed++;
                 setContent("Printing");
                 setProgress((slidesAnalyzed + slidesExtracted) / Convert.ToDouble(progress.totalSlides * 2) * 100);
                 break;
         }
     });
 }