Beispiel #1
0
        /// <summary>
        /// Gets multiple file names for file "Open" operation</summary>
        /// <param name="service">File dialog service</param>
        /// <param name="pathNames">Resulting file names</param>
        /// <param name="filter">File extension filter, e.g., "Setting file (*.xml;*.txt)|*.xml;*.txt|Any (*.*)|*.*"</param>
        /// <param name="directory">Directory that the user first sees, or null for default behavior</param>
        /// <returns>True iff operation is not cancelled</returns>
        public static FileDialogResult OpenFileNames(this IFileDialogService service, ref string[] pathNames, string filter, string directory)
        {
            string originalDir = service.ForcedInitialDirectory;

            try
            {
                service.ForcedInitialDirectory = directory;
                return(service.OpenFileNames(ref pathNames, filter));
            }
            finally
            {
                service.ForcedInitialDirectory = originalDir;
            }
        }