Example #1
0
        public ProgressDialog(ProgressDialogSettings settings)
        {
            InitializeComponent();
            WindowSettings.SetHideCloseButton(this, true);
            double top;
            double right;

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

            if (settings.ShowSubLabel)
            {
                top = 38;
                Height = 130;
                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;
        }
Example #2
0
        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);
        }
Example #3
0
 internal static ProgressDialogResult Execute(Window owner, string label, Func<object> operationWithResult, ProgressDialogSettings settings)
 {
     return ExecuteInternal(owner, label, (object)operationWithResult, settings);
 }
Example #4
0
 internal static ProgressDialogResult Execute(Window owner, string label, Func<BackgroundWorker, DoWorkEventArgs, object> operationWithResult, ProgressDialogSettings settings)
 {
     return ExecuteInternal(owner, label, (object)operationWithResult, settings);
 }
Example #5
0
 internal static ProgressDialogResult Execute(Window owner, string label, Action<BackgroundWorker> operation, ProgressDialogSettings settings)
 {
     return ExecuteInternal(owner, label, (object)operation, settings);
 }