예제 #1
0
 /// <summary>
 /// Hook up the busy indicator to the progress handler.
 /// This must be invoked by parent e.g., in Loaded as this.InitalizeProgressHandler(this.BusyCancelIndicator);
 /// </summary>
 /// <param name="busyCancelIndicator"></param>
 protected void InitalizeProgressHandler(BusyCancelIndicator busyCancelIndicator)
 {
     this.ProgressHandler = new Progress <ProgressBarArguments>(value =>
     {
         // Update the progress bar
         BusyableDialogWindow.UpdateProgressBar(busyCancelIndicator, value.PercentDone, value.Message, value.IsCancelEnabled, value.IsIndeterminate);
     });
     this.Progress = ProgressHandler;
 }
예제 #2
0
        // Show progress information in the passed in progress bar as indicated
        protected static void UpdateProgressBar(BusyCancelIndicator busyCancelIndicator, int percent, string message, bool isCancelEnabled, bool isIndeterminate)
        {
            // Check the arguments for null
            ThrowIf.IsNullArgument(busyCancelIndicator, nameof(busyCancelIndicator));

            // Set it as a progressive or indeterminate bar
            busyCancelIndicator.IsIndeterminate = isIndeterminate;

            // Set the progress bar position (only visible if determinate)
            busyCancelIndicator.Percent = percent;

            // Update the text message
            busyCancelIndicator.Message = message;

            // Update the cancel button to reflect the cancelEnabled argument
            busyCancelIndicator.CancelButtonIsEnabled = isCancelEnabled;
            busyCancelIndicator.CancelButtonText      = isCancelEnabled ? "Cancel" : "Writing data...";
        }