Ejemplo n.º 1
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            TaskDialogButtonData button = new TaskDialogButtonData(0, null, null);
            _buttons.Add(button);

            Buttons.SelectedItem = button;
        }
Ejemplo n.º 2
0
        private static TaskDialogResult ShowInlineCore(DependencyObject owner, string header, string content, string title, TaskDialogButtons standardButtons, TaskDialogIcon icon, bool useCommandLinks, params TaskDialogButtonData[] buttons)
        {
            if (title == null)
            {
                title = string.Empty;
            }

            if (content == string.Empty)
            {
                content = null;
            }

            var taskDialog = new TaskDialog
            {
                Title    = title,
                Header   = header,
                Content  = content,
                MainIcon = TaskDialogIconConverter.ConvertFrom(icon)
            };

            foreach (TaskDialogButtonData buttonData in TaskDialogButtonData.FromStandardButtons(standardButtons))
            {
                taskDialog.Buttons.Add(buttonData);
            }

            if (useCommandLinks)
            {
                foreach (TaskDialogButtonData buttonData in buttons)
                {
                    taskDialog.CommandLinks.Add(buttonData);
                }
            }
            else
            {
                foreach (TaskDialogButtonData buttonData in buttons)
                {
                    taskDialog.Buttons.Add(buttonData);
                }
            }

            if (owner == null && Application.Current != null)
            {
                owner = Application.Current.MainWindow;
            }

            taskDialog.Background = SystemColors.WindowBrush;

            taskDialog.ShowInline(owner);

            return(taskDialog.Result);
        }