示例#1
0
 public static bool ShowDialog(this CommonDialog dialog)
 {
     using (SpyCenterToActive cta = new SpyCenterToActive())
     {
         bool?result = dialog.ShowDialog(Application.Current.MainWindow);
         return(result.HasValue && result.Value);
     }
 }
示例#2
0
        public static bool ShowDialog(this CommonDialog dialog, DependencyObject owner)
        {
            using (SpyCenterToActive cta = new SpyCenterToActive())
            {
                Window win = WindowExtension.GetOwner(owner);

                bool?result = dialog.ShowDialog(win);
                return(result.HasValue && result.Value);
            }
        }
示例#3
0
        public static MessageBoxResult Show(DependencyObject owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
        {
            using (SpyCenterToActive cta = new SpyCenterToActive())
            {
                Window win = WindowExtension.GetOwner(owner);
                //
                if (string.IsNullOrEmpty(caption))
                {
                    caption = ApplicationTitle;
                }

                return(MessageBox.Show(win, messageBoxText, caption, button, icon, defaultResult, options));
            }
        }