public ProgressDialog(ProgressDialogSettings settings)
        {
            InitializeComponent();

            double top;
            double right;

            if (settings == null)
                settings = ProgressDialogSettings.WithLabelOnly;

            if (settings.ShowSubLabel)
            {
                top = 38;
                Height = 110;
                SubTextLabel.Visibility = Visibility.Visible;
            }
            else
            {
                top = 22;
                Height = 100;
                SubTextLabel.Visibility = Visibility.Collapsed;
            }

            if (settings.ShowCancelButton)
            {
                right = 74;
                CancelButton.Visibility = Visibility.Visible;
            }
            else
            {
                right = 0;
                CancelButton.Visibility = Visibility.Collapsed;
            }

            ProgressBar.Margin = new Thickness(0, top, right, 0);
            ProgressBar.IsIndeterminate = settings.ShowProgressBarIndeterminate;
        }
        internal static ProgressDialogResult ExecuteInternal(Window owner, string label, object operation, ProgressDialogSettings settings)
        {
            ProgressDialog dialog = new ProgressDialog(settings);
            dialog.Owner = owner;

            if (!string.IsNullOrEmpty(label))
                dialog.Label = label;

            return dialog.Execute(operation);
        }
 internal static ProgressDialogResult Execute(Window owner, string label, Func<object> operationWithResult, ProgressDialogSettings settings)
 {
     return ExecuteInternal(owner, label, (object)operationWithResult, settings);
 }
 internal static ProgressDialogResult Execute(Window owner, string label, Func<BackgroundWorker, DoWorkEventArgs, object> operationWithResult, ProgressDialogSettings settings)
 {
     return ExecuteInternal(owner, label, (object)operationWithResult, settings);
 }
 internal static ProgressDialogResult Execute(Window owner, string label, Action<BackgroundWorker> operation, ProgressDialogSettings settings)
 {
     return ExecuteInternal(owner, label, (object)operation, settings);
 }