public static bool ShowDialog(this CommonDialog dialog)
 {
     using (SpyCenterToActive cta = new SpyCenterToActive())
     {
         bool?result = dialog.ShowDialog(Application.Current.MainWindow);
         return(result.HasValue && result.Value);
     }
 }
        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);
            }
        }
Exemple #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));
            }
        }