Esempio n. 1
0
        private void DefaultButton_Click(object sender, RoutedEventArgs e)
        {
            if (TemplateData != null)
            {
                if (TaskDialog.OSSupportsTaskDialogs)
                {
                    using (TaskDialog dialog = new TaskDialog())
                    {
                        dialog.CenterParent = true;
                        dialog.WindowTitle  = "Reset " + TemplateData.Name + " to Default?";
                        dialog.Content      = "Current changes will be lost.";
                        //dialog.ExpandedInformation = "";
                        //dialog.Footer = "Task Dialogs support footers and can even include <a href=\"http://www.ookii.org\">hyperlinks</a>.";
                        dialog.FooterIcon = TaskDialogIcon.Information;
                        dialog.AllowDialogCancellation = true;
                        //dialog.EnableHyperlinks = true;
                        TaskDialogButton okButton     = new TaskDialogButton(ButtonType.Ok);
                        TaskDialogButton cancelButton = new TaskDialogButton(ButtonType.Cancel);
                        dialog.Buttons.Add(okButton);
                        dialog.Buttons.Add(cancelButton);
                        dialog.ButtonStyle = TaskDialogButtonStyle.Standard;

                        //dialog.HyperlinkClicked += new EventHandler<HyperlinkClickedEventArgs>(TaskDialog_HyperLinkClicked);
                        TaskDialogButton button = dialog.ShowDialog(App.Current.MainWindow);
                        if (button == okButton)
                        {
                            TemplateData.SetToDefault();
                        }
                    }
                }
                else
                {
                    TemplateData.SetToDefault();
                }
            }
        }