Bloom.ToPalaso.Experimental.ProgressDialogForeground.ShowAndDoWork C# (CSharp) Method

ShowAndDoWork() public method

public ShowAndDoWork ( Action work ) : void
work Action
return void
        public void ShowAndDoWork(Action<IProgress> work)
        {
            _work = work;
            Progress.ProgressIndicator = ProgressBar;
            Progress.AddStatusProgress(_status);
            Progress.AddMessageProgress(_messageLabelProgress);
            Progress.Add(new ApplicationDoEventsProgress());//this will keep our UI alive
            var stringProgress = new StringBuilderProgress();
            Progress.Add(stringProgress);
            Application.Idle += StartWorking;
            ShowDialog();
            if (Progress.ErrorEncountered)
            {
                SIL.Reporting.ErrorReport.NotifyUserOfProblem("There was a problem performing that operation.\r\n\r\n"+stringProgress.Text);
            }
        }

Usage Example

Example #1
0
 public void CopyImageMetadataToWholeBook(Metadata metadata)
 {
     using (var dlg = new ProgressDialogForeground())//REVIEW: this foreground dialog has known problems in other contexts... it was used here because of its ability to handle exceptions well. TODO: make the background one handle exceptions well
     {
         dlg.ShowAndDoWork(progress => CurrentBook.CopyImageMetadataToWholeBookAndSave(metadata, progress));
     }
 }
All Usage Examples Of Bloom.ToPalaso.Experimental.ProgressDialogForeground::ShowAndDoWork