Exemplo n.º 1
0
        private protected override bool RunFileDialog(NativeMethods.OPENFILENAME_I ofn)
        {
            bool result = UnsafeNativeMethods.GetSaveFileName(ofn);

            if (!result)
            {
                // Something may have gone wrong - check for error condition
                switch (Comdlg32.CommDlgExtendedError())
                {
                case Comdlg32.FNERR.INVALIDFILENAME:
                    throw new InvalidOperationException(string.Format(SR.FileDialogInvalidFileName, FileName));
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <include file='doc\SaveFileDialog.uex' path='docs/doc[@for="SaveFileDialog.RunFileDialog"]/*' />
        /// <devdoc>
        /// </devdoc>
        /// <internalonly/>
        internal override bool RunFileDialog(NativeMethods.OPENFILENAME_I ofn)
        {
            bool result = UnsafeNativeMethods.GetSaveFileName(ofn);

            if (!result)
            {
                // Something may have gone wrong - check for error condition
                //
                int errorCode = SafeNativeMethods.CommDlgExtendedError();
                switch (errorCode)
                {
                case NativeMethods.FNERR_INVALIDFILENAME:
                    throw new InvalidOperationException(string.Format(SR.FileDialogInvalidFileName, FileName));
                }
            }

            return(result);
        }
Exemplo n.º 3
0
        /// <include file='doc\SaveFileDialog.uex' path='docs/doc[@for="SaveFileDialog.RunFileDialog"]/*' />
        /// <devdoc>
        /// </devdoc>
        /// <internalonly/>
        internal override bool RunFileDialog(NativeMethods.OPENFILENAME_I ofn)
        {
            //We have already done the demand in EnsureFileDialogPermission but it doesn't hurt to do it again
            Debug.WriteLineIf(IntSecurity.SecurityDemand.TraceVerbose, "FileDialogSaveFile Demanded in SaveFileDialog.RunFileDialog");
            IntSecurity.FileDialogSaveFile.Demand();

            bool result = UnsafeNativeMethods.GetSaveFileName(ofn);

            if (!result)
            {
                // Something may have gone wrong - check for error condition
                //
                int errorCode = SafeNativeMethods.CommDlgExtendedError();
                switch (errorCode)
                {
                case NativeMethods.FNERR_INVALIDFILENAME:
                    throw new InvalidOperationException(string.Format(SR.FileDialogInvalidFileName, FileName));
                }
            }

            return(result);
        }