Provides a visual representation of the progress of a long running operation.
Inheritance: TaskDialogBar
コード例 #1
0
ファイル: TaskDialog.cs プロジェクト: robertbaker/SevenUpdate
        /// <summary>Sorts the dialog controls.</summary>
        void SortDialogControls()
        {
            foreach (var control in controls)
            {
                var buttonBase  = control as TaskDialogButtonBase;
                var commandLink = control as TaskDialogCommandLink;

                if (buttonBase != null && string.IsNullOrEmpty(buttonBase.Text) && commandLink != null &&
                    string.IsNullOrEmpty(commandLink.Instruction))
                {
                    throw new InvalidOperationException(Resources.TaskDialogButtonTextEmpty);
                }

                TaskDialogRadioButton radButton;
                TaskDialogProgressBar progBar;

                // Loop through child controls and sort the controls based on type.
                if (commandLink != null)
                {
                    commandLinks.Add(commandLink);
                }
                else if ((radButton = control as TaskDialogRadioButton) != null)
                {
                    if (radioButtons == null)
                    {
                        radioButtons = new List <TaskDialogButtonBase>();
                    }

                    radioButtons.Add(radButton);
                }
                else if (buttonBase != null)
                {
                    if (buttons == null)
                    {
                        buttons = new List <TaskDialogButtonBase>();
                    }

                    buttons.Add(buttonBase);
                }
                else if ((progBar = control as TaskDialogProgressBar) != null)
                {
                    progressBar = progBar;
                }
                else
                {
                    throw new InvalidOperationException(Resources.TaskDialogUnkownControl);
                }
            }
        }