Пример #1
0
        private string GetFilePathFromOpenFileDialog(EditorForm view)
        {
            // Configure open file dialog
            var initialDirectory = Directory.Exists(Settings.Default.MruGameFolderPath)
                ? Settings.Default.MruGameFolderPath
                : Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            view.SetOpenFileDialogInitialDirectory(initialDirectory);
            view.SetOpenFileDialogFileName(null);

            // Get file from user
            var dialogResult = view.ShowOpenFileDialog();

            // Return null if no file was selected, else return filename of selected file
            return(dialogResult != DialogResult.OK ? null : view.GetOpenFileDialogFileName());
        }