コード例 #1
0
ファイル: Dialog.cs プロジェクト: X-Lars/ControlsXL
        /// <summary>
        /// Creates and initializes a new <see cref="ProgressDialog"/> instance with a progress bar and status text.
        /// </summary>
        /// <param name="title">A <see cref="string"/> defining the title of the <see cref="ProgressDialog"/>.</param>
        /// <param name="message">A <see cref="string"/> defining the message of the <see cref="ProgressDialog"/>.</param>
        /// <param name="status">A <see cref="string"/> defining the status text of the <see cref="ProgressDialog"/>.</param>
        /// <param name="showProgress">A <see cref="bool"/> to determine if the progress bar is shown.</param>
        /// <param name="isIndeterminate">A <see cref="bool"/> to determine if the <see cref="ProgressDialog"/> is indeterminate.</param>
        /// <param name="canCancel">A <see cref="bool"/> to determine if the <see cref="ProgressDialog"/> operation can be cancelled.</param>
        /// <param name="style">The style of the progress indicator.</param>
        /// <remarks><i>Use the <see cref="DialogManager.Show(Dialog)"/> method to attach the <see cref="ProgressDialog"/> to the UI.</i></remarks>
        public ProgressDialog(string title, string message, string status, bool isIndeterminate = false, bool canCancel = false, ProgressIndicatorStyles style = ProgressIndicatorStyles.Linear) : base()
        {
            Title           = title;
            Message         = message;
            Status          = status;
            IsIndeterminate = isIndeterminate;
            CanCancel       = canCancel;

            ShowProgress  = true;
            ProgressStyle = style;
            ShowStatus    = true;
        }
コード例 #2
0
ファイル: DialogManager.cs プロジェクト: X-Lars/ControlsXL
        /// <summary>
        /// Creates a new <see cref="ProgressDialog"/> and attaches it to the UI.
        /// </summary>
        /// <param name="title">A <see cref="string"/> specifying the title.</param>
        /// <param name="message">A <see cref="string"/> specifying the message.</param>
        /// <param name="status">A <see cref="string"/> specifying the status text.</param>
        /// <param name="isIndeterminate">A <see cref="bool"/> to determine whether the dialog is indeterminate.</param>
        /// <param name="canCancel">A <see cref="bool"/> to determine whether the dialog supports cancellation.</param>
        /// <returns>A reference to the created <see cref="ProgressDialog"/>.</returns>
        public static ProgressDialog ProgressDialog(string title, string message, string status, bool isIndeterminate = false, bool canCancel = false, ProgressIndicatorStyles style = ProgressIndicatorStyles.Linear)
        {
            ProgressDialog dialog = null;

            _Dispatcher.Invoke(() =>
            {
                dialog = new ProgressDialog(title, message, status, isIndeterminate, canCancel, style);
                dialog.CloseRequested += DialogCloseRequested;

                _Placeholder.Content = dialog;

                lock (_Dialogs)
                {
                    _Dialogs.Push(dialog);
                }
            });

            return(dialog);
        }