Пример #1
0
        /// <summary>
        /// Use of the OpenFileDialog
        /// </summary>
        /// <param name="dialogData">The parameters used in the OpenFileDialog</param>
        /// <returns>Reference to the OpenFileDialog</returns>
        private static Microsoft.Win32.OpenFileDialog OpenDialog(RwOpenFileDialogCreationData dialogData)
        {
            Microsoft.Win32.OpenFileDialog openDialog = new Microsoft.Win32.OpenFileDialog
            {
                Title       = dialogData.Title,
                Filter      = dialogData.Filter,
                Multiselect = dialogData.Multiselect
            };

            return(openDialog);
        }
Пример #2
0
        /// <summary>
        /// Use of the OpenFileDialog to select multiple files
        /// </summary>
        /// <param name="dialogData">The parameters used in the OpenFileDialog</param>
        /// <returns>The selected files</returns>
        public static List <string> OpenFilesDialog(RwOpenFileDialogCreationData dialogData)
        {
            List <string> files = new List <string>();

            Microsoft.Win32.OpenFileDialog openFileDialog = OpenDialog(dialogData);
            if (openFileDialog.ShowDialog() == true)
            {
                files.AddRange(openFileDialog.FileNames);
            }

            return(files);
        }
Пример #3
0
        /// <summary>
        /// Use of the OpenFileDialog to select a single file
        /// </summary>
        /// <param name="dialogData">The parameters used in the OpenFileDialog</param>
        /// <returns>The selected single file</returns>
        public static string OpenFileDialog(RwOpenFileDialogCreationData dialogData)
        {
            string file = string.Empty;

            Microsoft.Win32.OpenFileDialog openFileDialog = OpenDialog(dialogData);
            if (openFileDialog.ShowDialog() == true)
            {
                file = openFileDialog.FileName;
            }

            return(file);
        }