ShowDialog() public method

Shows the task dialog as a modal dialog box with the currently active window set as its owner.
public ShowDialog ( ) : DialogResult
return DialogResult
Esempio n. 1
0
        /// <summary>
        /// Show a task dialog using the specified values as content.
        /// </summary>
        /// <param name="windowTitle">Caption of the window.</param>
        /// <param name="mainInstruction">Principal text.</param>
        /// <param name="content">Extra text.</param>
        /// <param name="icon">Predefined icon.</param>
        /// <param name="commonButtons">Common buttons.</param>
        /// <returns>One of the DialogResult values.</returns>
        public static DialogResult Show(string windowTitle,
                                        string mainInstruction,
                                        string content,
                                        MessageBoxIcon icon,
                                        TaskDialogButtons commonButtons)
        {
            // Create a temporary task dialog for storing definition whilst showing
            using (KryptonTaskDialog taskDialog = new KryptonTaskDialog())
            {
                // Store incoming values
                taskDialog.WindowTitle     = windowTitle;
                taskDialog.MainInstruction = mainInstruction;
                taskDialog.Content         = content;
                taskDialog.Icon            = icon;
                taskDialog.CommonButtons   = commonButtons;

                // Show as a modal dialog
                return(taskDialog.ShowDialog());
            }
        }
        /// <summary>
        /// Show a task dialog using the specified values as content.
        /// </summary>
        /// <param name="windowTitle">Caption of the window.</param>
        /// <param name="mainInstruction">Principal text.</param>
        /// <param name="content">Extra text.</param>
        /// <param name="icon">Predefined icon.</param>
        /// <param name="commonButtons">Common buttons.</param>
        /// <returns>One of the DialogResult values.</returns>
        public static DialogResult Show(string windowTitle,
                                        string mainInstruction,
                                        string content,
                                        MessageBoxIcon icon,
                                        TaskDialogButtons commonButtons)
        {
            // Create a temporary task dialog for storing definition whilst showing
            using (KryptonTaskDialog taskDialog = new KryptonTaskDialog())
            {
                // Store incoming values
                taskDialog.WindowTitle = windowTitle;
                taskDialog.MainInstruction = mainInstruction;
                taskDialog.Content = content;
                taskDialog.Icon = icon;
                taskDialog.CommonButtons = commonButtons;

                // Show as a modal dialog
                return taskDialog.ShowDialog();
            }
        }
Esempio n. 3
0
 bool Confirm(string pKey, string pMsg)
 {
     if (((ToolStripMenuItem)this.ToolStripMenuItemOption.DropDownItems[pKey]).Checked)
     {
         KryptonTaskDialog dialog = new KryptonTaskDialog
         {
             CheckboxText = @"以后不再确认",
             CheckboxState = false,
             WindowTitle = @"确认",
             MainInstruction = string.Format("{0}\t", pMsg),//不加\t中文显示缺最后一个字
             Icon = MessageBoxIcon.Question,
             CommonButtons = TaskDialogButtons.OK | TaskDialogButtons.Cancel
         };
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             ((ToolStripMenuItem)this.ToolStripMenuItemOption.DropDownItems[pKey]).Checked = dialog.CheckboxState == false;
             return true;
         }
         return false;
     }
     return true;
 }
Esempio n. 4
0
        private string CheckFileExists(string filename)
        {
            if (File.Exists(filename))
                return filename;

            if (_textData.IsOpened && Path.GetFileName(_textData.Filename) == Path.GetFileName(filename))
                return filename;

            string baseDir = Utilities.GetAbsolutePath(Properties.Settings.Default.ScriptPath);

            var files = Directory.GetFiles(baseDir, Path.GetFileName(filename), SearchOption.AllDirectories);
            if (files.Length == 0)
                return null;

            var ktd = new KryptonTaskDialog
            {
                Icon = MessageBoxIcon.Information,
                CommonButtons = TaskDialogButtons.Cancel,
                WindowTitle = "����ȥ����浵�м�¼��·����Ϣ��̫��ȷ",
                MainInstruction = "��������������ļ���������ȷ�ġ���",
                Content = Utilities.GetRelativePath(files[0], Utilities.GetAbsolutePath("")),
            };

            var ktdcOk = new KryptonTaskDialogCommand
            {
                DialogResult = DialogResult.OK,
                Image = Properties.Resources.arrow_right_green,
                Text = "��������",
            };
            var ktdcNo = new KryptonTaskDialogCommand
            {
                DialogResult = DialogResult.Cancel,
                Image = Properties.Resources.arrow_right_red,
                Text = "��������Ǵ����",
            };

            ktd.CommandButtons.AddRange(new[] { ktdcOk, ktdcNo });
            if (ktd.ShowDialog() == DialogResult.OK)
                return files[0];

            return null;
        }