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