コード例 #1
0
ファイル: TaskDialog.cs プロジェクト: angelstam/Luminous
 /// <summary>
 /// Displays a task dialog in front of the specified window and with the specified title, intruction, content, title, buttons and icon..
 /// </summary>
 /// <param name="owner">A window that will own the modal dialog box.</param>
 /// <param name="windowTitle">The text to display in the title bar of the task dialog.</param>
 /// <param name="mainInstruction">The instruction to display in the task dialog.</param>
 /// <param name="content">The text to display in the task dialog.</param>
 /// <param name="commonButtons">One of the TaskDialogCommonButtons values that specifies which buttons to display in the task dialog.</param>
 /// <param name="icon">One of the TaskDialogIcon values that specifies which icon to display in the task dialog.</param>
 /// <returns>One of the TaskDialogResult values.</returns>
 public static TaskDialogResult Show(Window owner, string windowTitle, string mainInstruction, string content, TaskDialogCommonButtons commonButtons, TaskDialogIcon icon)
 {
     TaskDialogWindow td = new TaskDialogWindow(null, true) { Owner = owner, WindowTitle = windowTitle, MainIcon = icon, MainInstruction = mainInstruction, ContentText = content, CommonButtons = commonButtons };
     td.DefaultButton = TaskDialogHelpers.GetFirstButton(commonButtons);
     td.UseCommandLinks = true;
     td.ShowDialog();
     return (TaskDialogResult)td.Tag;
 }
コード例 #2
0
 protected override void OnSourceInitialized(EventArgs e)
 {
     base.OnSourceInitialized(e);
     if (!_IsCancellable)
     {
         DisableCloseButton();
     }
     else
     {
         EnableCloseButton();
     }
     TaskDialogHelpers.RemoveWindowIcon(this);
 }
コード例 #3
0
 protected override void OnPreviewKeyDown(KeyEventArgs e)
 {
     if (e.Key == Key.C && Keyboard.Modifiers == ModifierKeys.Control)
     {
         try
         {
             SoundScheme.Default.Play();
             Clipboard.SetText(_IsTaskDialog ? TaskDialogHelpers.TaskDialogToString(this) : TaskDialogHelpers.MessageBoxToString(this));
         }
         catch { }
     }
     base.OnPreviewKeyDown(e);
 }
コード例 #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            EnableCloseButton();
            object tag = (sender as Button).Tag;

            if (tag is TaskDialogButton)
            {
                Tag = ((TaskDialogButton)tag).Result;
            }
            else
            {
                Tag = TaskDialogHelpers.TaskDialogCommonButtonsToTaskDialogResult((TaskDialogCommonButtons)tag);
            }
            Close();
        }
コード例 #5
0
 private void SetDefaultButton()
 {
     foreach (Button b in PanelCommandLinks.Children.OfType <CommandLink>().Cast <Button>().Concat(PanelRightButtons.Children.OfType <Button>()))
     {
         if ((b.Tag is TaskDialogButton && ((TaskDialogButton)b.Tag).Result == DefaultButton) ||
             (b.Tag is TaskDialogCommonButtons && TaskDialogHelpers.TaskDialogCommonButtonsToTaskDialogResult((TaskDialogCommonButtons)b.Tag) == DefaultButton))
         {
             _DefaultButtonToFocus = b;
             b.Focus();
             b.IsDefault = true;
             if (_IsOnlyOK == true)
             {
                 b.IsCancel = true;
             }
             return;
         }
         else if (b.IsDefault)
         {
             b.IsDefault = false;
         }
     }
 }
コード例 #6
0
ファイル: TaskDialog.cs プロジェクト: angelstam/Luminous
 /// <summary>
 /// Displays a task dialog in front of the specified window and with the specified text, title, buttons, and icon.
 /// </summary>
 /// <param name="owner">A window that will own the modal dialog box.</param>
 /// <param name="text">The text to display in the task dialog.</param>
 /// <param name="title">The text to display in the title bar of the task dialog.</param>
 /// <param name="buttons">One of the TaskDialogCommonButtons values that specifies which buttons to display in the task dialog.</param>
 /// <param name="icon">One of the TaskDialogIcon values that specifies which icon to display in the task dialog.</param>
 /// <returns>One of the TaskDialogResult values.</returns>
 public static TaskDialogResult Show(Window owner, string text, string title, TaskDialogCommonButtons buttons, TaskDialogIcon icon)
 {
     return Show(owner, text, title, buttons, icon, TaskDialogHelpers.GetFirstButton(buttons));
 }
コード例 #7
0
 /// <summary>
 /// Displays a task dialog with specified text, title, buttons, and icon.
 /// </summary>
 /// <param name="text">The text to display in the task dialog.</param>
 /// <param name="title">The text to display in the title bar of the task dialog.</param>
 /// <param name="buttons">One of the TaskDialogCommonButtons values that specifies which buttons to display in the task dialog.</param>
 /// <param name="icon">One of the TaskDialogIcon values that specifies which icon to display in the task dialog.</param>
 /// <returns>One of the TaskDialogResult values.</returns>
 public static TaskDialogResult Show(string text, string title, TaskDialogCommonButtons buttons, TaskDialogIcon icon)
 {
     return(Show(DefaultOwnerWindow, text, title, buttons, icon, TaskDialogHelpers.GetFirstButton(buttons)));
 }
コード例 #8
0
 private void DisableCloseButton()
 {
     RemoveHook();
     AddHook();
     TaskDialogHelpers.EnableCloseButton(this, false);
 }
コード例 #9
0
 private void EnableCloseButton()
 {
     RemoveHook();
     TaskDialogHelpers.EnableCloseButton(this, true);
 }