Ejemplo n.º 1
0
        private bool Confirm(string TaskName)
        {
            if (isVista)
            {
                TaskDialog td = new TaskDialog();
                TaskDialogStandardButtons button = TaskDialogStandardButtons.Yes;
                button            |= TaskDialogStandardButtons.No;
                td.Icon            = TaskDialogStandardIcon.Information;
                td.StandardButtons = button;
                td.InstructionText = TaskName;
                td.Caption         = TaskName;
                td.Text            = Properties.Resources.Str_Confirm;
                TaskDialogResult res = td.Show();

                if (res.ToString() != "Yes")
                {
                    return(false);
                }
            }
            else
            {
                DialogResult result = MessageBox.Show(
                    Properties.Resources.Str_Confirm,
                    Properties.Resources.Confirm,
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button1);
                if (result != DialogResult.Yes)
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Task Dialog static sampler
        /// There are three overloads for static Show().
        /// </summary>
        public void ShowTaskDialogStatic()
        {
            // (1) simplest of all. title and main instruction. has default [Close] button at lower right corner.
            TaskDialog.Show("Task Dialog Static 1", "Main message");

            // (2) this version accepts command buttons in addition to above.
            // Here we add [Yes] [No] [Cancel}

            TaskDialogResult res2 = default(TaskDialogResult);

            res2 = TaskDialog.Show("Task Dialog Static 2", "Main message", (TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No | TaskDialogCommonButtons.Cancel));

            // What did the user pressed?
            TaskDialog.Show("Show task dialog", "You pressed: " + res2.ToString());

            // (3) this version accepts default button in addition to above.
            // Here we set [No] as a default (just for testing purposes).

            TaskDialogResult res3          = default(TaskDialogResult);
            TaskDialogResult defaultButton = TaskDialogResult.No;

            res3 = TaskDialog.Show("Task Dialog Static 3", "Main message", (TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No | TaskDialogCommonButtons.Cancel), defaultButton);

            // What did the user press?

            TaskDialog.Show("Show task dialog", "You pressed: " + res3.ToString());
        }
Ejemplo n.º 3
0
        void ShowTestTaskDialogButton_Click(object sender, RoutedEventArgs e)
        {
            XamlTaskDialog   xamlTaskDialog = new XamlTaskDialog();
            TaskDialogResult result         = xamlTaskDialog.ShowModal(this);

            MessageBox.Show(result.ToString(), "Task Dialog Result");
        }
Ejemplo n.º 4
0
        private void linkCommonButtons_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            TaskDialogResult result     = dialogCommonButtons.Show();
            string           buttonText = result == TaskDialogResult.Ok ? "OK" : result.ToString();

            MessageBox.Show(string.Format("The \"{0}\" button was clicked.", buttonText),
                            "Common Buttons Sample");
        }
Ejemplo n.º 5
0
            static TaskDialogCommandLink CreateTaskDialogCommandLink(string text, string instructions, TaskDialogResult taskDialogResult, bool isDefault = false)
            {
                var taskDialogCommandLink = new TaskDialogCommandLink(taskDialogResult.ToString(), text, instructions)
                {
                    Default = isDefault
                };

                taskDialogCommandLink.Click += TaskDialogCommandLinkClicked !;

                return(taskDialogCommandLink);
            }
Ejemplo n.º 6
0
        /// <summary>
        /// Task Dialog - create an instance of task dialog gives you more options.
        /// cf. Developer guide, Figure 223 (on pp 405) has a image of all the components visible.
        /// This function is to visulize what kind of contents you can add with TaskDialog.
        /// Note: actual interpretation of
        /// </summary>
        public void ShowTaskDialogInstance(bool stepByStep)
        {
            // (0) create an instance of task dialog to set more options.
            TaskDialog myDialog = new TaskDialog("Revit UI Labs - Task Dialog Options");

            if (stepByStep)
            {
                myDialog.Show();
            }

            // (1) set the main area. these appear at the upper portion of the dialog.

            myDialog.MainIcon = TaskDialogIcon.TaskDialogIconWarning;
            // or TaskDialogIcon.TaskDialogIconNone.
            if (stepByStep)
            {
                myDialog.Show();
            }

            myDialog.MainInstruction = "Main instruction: This is Revit UI Lab 3 Task Dialog";
            if (stepByStep)
            {
                myDialog.Show();
            }

            myDialog.MainContent = "Main content: You can add detailed description here.";
            if (stepByStep)
            {
                myDialog.Show();
            }

            // (2) set the bottom area

            myDialog.CommonButtons = TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No | TaskDialogCommonButtons.Cancel;
            myDialog.DefaultButton = TaskDialogResult.Yes;
            if (stepByStep)
            {
                myDialog.Show();
            }

            myDialog.ExpandedContent = "Expanded content: the visibility of this portion is controled by Show/Hide button.";
            if (stepByStep)
            {
                myDialog.Show();
            }

            myDialog.VerificationText = "Verification: Do not show this message again comes here";
            if (stepByStep)
            {
                myDialog.Show();
            }

            myDialog.FooterText = "Footer: <a href=\"http://www.autodesk.com/developrevit\">Revit Developer Center</a>";
            if (stepByStep)
            {
                myDialog.Show();
            }

            // (4) add command links. you can add up to four links

            myDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "Command Link 1", "description 1");
            if (stepByStep)
            {
                myDialog.Show();
            }
            myDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "Command Link 2", "description 2");
            if (stepByStep)
            {
                myDialog.Show();
            }
            myDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink3, "Command Link 3", "you can add up to four command links");
            if (stepByStep)
            {
                myDialog.Show();
            }
            myDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink4, "Command Link 4", "Can also have URLs e.g. Revit Product Online Help");
            //if (stepByStep) myDialog.Show();

            // Show it.
            TaskDialogResult res = myDialog.Show();

            if (TaskDialogResult.CommandLink4 == res)
            {
                System.Diagnostics.Process process = new System.Diagnostics.Process();
                // process.StartInfo.FileName = "http://docs.autodesk.com/REVIT/2011/ENU/landing.html";
                //process.StartInfo.FileName = "http://wikihelp.autodesk.com/Revit/enu/2012";
                process.StartInfo.FileName = "http://wikihelp.autodesk.com/Revit/enu/2013";
                process.Start();
            }

            TaskDialog.Show("Show task dialog", "The last action was: " + res.ToString());
        }
Ejemplo n.º 7
0
        private void cmdShow_Click(object sender, EventArgs e)
        {
            TaskDialog td = new TaskDialog();

            #region Button(s)

            TaskDialogStandardButtons button = TaskDialogStandardButtons.None;

            if (chkOK.Checked)
            {
                button |= TaskDialogStandardButtons.Ok;
            }
            if (chkCancel.Checked)
            {
                button |= TaskDialogStandardButtons.Cancel;
            }

            if (chkYes.Checked)
            {
                button |= TaskDialogStandardButtons.Yes;
            }
            if (chkNo.Checked)
            {
                button |= TaskDialogStandardButtons.No;
            }

            if (chkClose.Checked)
            {
                button |= TaskDialogStandardButtons.Close;
            }
            if (chkRetry.Checked)
            {
                button |= TaskDialogStandardButtons.Retry;
            }

            #endregion

            #region Icon

            if (rdoError.Checked)
            {
                td.Icon = TaskDialogStandardIcon.Error;
            }
            else if (rdoInformation.Checked)
            {
                td.Icon = TaskDialogStandardIcon.Information;
            }
            else if (rdoShield.Checked)
            {
                td.Icon = TaskDialogStandardIcon.Shield;
            }
            else if (rdoWarning.Checked)
            {
                td.Icon = TaskDialogStandardIcon.Warning;
            }

            #endregion

            #region Prompts

            string title       = txtTitle.Text;
            string instruction = txtInstruction.Text;
            string content     = txtContent.Text;

            #endregion

            td.StandardButtons   = button;
            td.InstructionText   = instruction;
            td.Caption           = title;
            td.Text              = content;
            td.OwnerWindowHandle = this.Handle;

            TaskDialogResult res = td.Show();

            this.resultLbl.Text = "Result = " + res.ToString();
        }
Ejemplo n.º 8
0
 internal TaskDialogButton(TaskDialogResult standardButtonResult)
 {
     _standardButtonResult = standardButtonResult;
     _text = standardButtonResult.ToString();
 }
Ejemplo n.º 9
0
        private static void buttonCommon_Click(object sender, EventArgs e)
        {
            // Common buttons sample
            TaskDialog tdCommonButtons = new TaskDialog();

            tdCommonButtons.Cancelable      = true;
            tdCommonButtons.Caption         = "Common Buttons Sample";
            tdCommonButtons.InstructionText = "Click on any of the buttons to get a specific message box";

            tdCommonButtons.StandardButtons =
                TaskDialogStandardButtons.Ok |
                TaskDialogStandardButtons.Cancel |
                TaskDialogStandardButtons.Yes |
                TaskDialogStandardButtons.No |
                TaskDialogStandardButtons.Retry |
                TaskDialogStandardButtons.Cancel |
                TaskDialogStandardButtons.Close;

            TaskDialogResult tdr = tdCommonButtons.Show();

            MessageBox.Show(string.Format("The \"{0}\" button was clicked", tdr == TaskDialogResult.Ok ? "OK" : tdr.ToString()), "Common Buttons Sample");
        }