Exemple #1
0
        private FileDialogNative.FOS GetOptions()
        {
            const FileDialogNative.FOS BlittableOptions =
                FileDialogNative.FOS.FOS_OVERWRITEPROMPT
                | FileDialogNative.FOS.FOS_NOCHANGEDIR
                | FileDialogNative.FOS.FOS_NOVALIDATE
                | FileDialogNative.FOS.FOS_ALLOWMULTISELECT
                | FileDialogNative.FOS.FOS_PATHMUSTEXIST
                | FileDialogNative.FOS.FOS_FILEMUSTEXIST
                | FileDialogNative.FOS.FOS_CREATEPROMPT
                | FileDialogNative.FOS.FOS_NODEREFERENCELINKS
            ;
            const int UnexpectedOptions =
                NativeMethods.OFN_USESHELLITEM   //This is totally bogus (only used in FileDialog by accident to ensure that places are shown
                | NativeMethods.OFN_SHOWHELP     //If ShowHelp is true, we don't use the Vista Dialog
                | NativeMethods.OFN_ENABLEHOOK   //These shouldn't be set in options (only set in the flags for the legacy dialog)
                | NativeMethods.OFN_ENABLESIZING //These shouldn't be set in options (only set in the flags for the legacy dialog)
                | NativeMethods.OFN_EXPLORER     //These shouldn't be set in options (only set in the flags for the legacy dialog)
            ;

            System.Diagnostics.Debug.Assert(0 == (UnexpectedOptions & options), "Unexpected FileDialog options");

            FileDialogNative.FOS ret = (FileDialogNative.FOS)options & BlittableOptions;

            //Force no mini mode for the SaveFileDialog
            ret |= FileDialogNative.FOS.FOS_DEFAULTNOMINIMODE;

            // Make sure that the Open dialog allows the user to specify
            // non-file system locations. This flag will cause the dialog to copy the resource
            // to a local cache (Temporary Internet Files), and return that path instead. This
            // also affects the Save dialog by disallowing navigation to these areas.
            // An example of a non-file system location is a URL (http://), or a file stored on
            // a digital camera that is not mapped to a drive letter.
            // This reproduces the behavior of the "classic" Open and Save dialogs.
            ret |= FileDialogNative.FOS.FOS_FORCEFILESYSTEM;

            return(ret);
        }
Exemple #2
0
 private FileDialogNative.FOS GetOptions()
 {
     FileDialogNative.FOS fos = ((FileDialogNative.FOS) this.options) & (FileDialogNative.FOS.FOS_ALLOWMULTISELECT | FileDialogNative.FOS.FOS_CREATEPROMPT | FileDialogNative.FOS.FOS_FILEMUSTEXIST | FileDialogNative.FOS.FOS_NOCHANGEDIR | FileDialogNative.FOS.FOS_NODEREFERENCELINKS | FileDialogNative.FOS.FOS_NOVALIDATE | FileDialogNative.FOS.FOS_OVERWRITEPROMPT | FileDialogNative.FOS.FOS_PATHMUSTEXIST);
     fos |= FileDialogNative.FOS.FOS_DEFAULTNOMINIMODE;
     return(fos | FileDialogNative.FOS.FOS_FORCEFILESYSTEM);
 }