Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
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;
         }
     }
 }