Пример #1
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);
            }
        }
Пример #2
0
        public static bool ShowDialog(this Window win, DependencyObject owner)
        {
            win.Owner = WindowExtension.GetOwner(owner);

            if (win.Owner != null && win.Icon == null && win.Owner.Icon != null)
            {
                win.Icon = win.Owner.Icon;
            }

            bool?result = win.ShowDialog();

            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));
            }
        }