상속: System.Windows.Forms.IWin32Window
예제 #1
0
        internal DialogResult ShowDialogExt(FileDialog fdlg, IWin32Window owner)
        {
            DialogResult returnDialogResult = DialogResult.Cancel;

            if (base.IsDisposed)
            {
                return(returnDialogResult);
            }
            if (owner == null || owner.Handle == IntPtr.Zero)
            {
                owner = new FileDialogControlBase.WindowWrapper(Process.GetCurrentProcess().MainWindowHandle);
            }
            this.OriginalCtrlSize = base.Size;
            this.MSDialog         = fdlg;
            this._dlgWrapper      = new FileDialogControlBase.WholeDialogWrapper(this);
            try
            {
                PropertyInfo AutoUpgradeInfo = this.MSDialog.GetType().GetProperty("AutoUpgradeEnabled");
                if (AutoUpgradeInfo != null)
                {
                    AutoUpgradeInfo.SetValue(this.MSDialog, false, null);
                }
                returnDialogResult = this._MSdialog.ShowDialog(owner);
            }
            catch (ObjectDisposedException)
            {
            }
            catch (Exception ex)
            {
                MessageBox.Show("unable to get the modal dialog handle", ex.Message);
            }
            return(returnDialogResult);
        }
예제 #2
0
        public DialogResult ShowDialog(IWin32Window owner)
        {
            DialogResult returnDialogResult = DialogResult.Cancel;

            if (base.IsDisposed)
            {
                return(returnDialogResult);
            }
            if (owner == null || owner.Handle == IntPtr.Zero)
            {
                owner = new FileDialogControlBase.WindowWrapper(Process.GetCurrentProcess().MainWindowHandle);
            }
            this.OriginalCtrlSize = base.Size;
            _MSdialog             = (FileDlgType == FileDialogType.OpenFileDlg) ? new OpenFileDialog() as FileDialog : new SaveFileDialog() as FileDialog;
            this._dlgWrapper      = new FileDialogControlBase.WholeDialogWrapper(this);
            this.OnPrepareMSDialog();
            if (!this._hasRunInitMSDialog)
            {
                this.InitMSDialog();
            }
            try
            {
                PropertyInfo AutoUpgradeInfo = this.MSDialog.GetType().GetProperty("AutoUpgradeEnabled");
                if (AutoUpgradeInfo != null)
                {
                    AutoUpgradeInfo.SetValue(this.MSDialog, false, null);
                }
                returnDialogResult = this._MSdialog.ShowDialog(owner);
            }
            catch (ObjectDisposedException)
            {
            }
            catch (Exception ex)
            {
                MessageBox.Show("unable to get the modal dialog handle", ex.Message);
            }
            return(returnDialogResult);
        }