コード例 #1
0
        /// <summary>
        /// Gets the file path to export to.
        /// </summary>
        /// <param name="inquiryHelper">Helper responsible for performing information inquiries.</param>
        /// <param name="fileFilterGenerator">The file filter generator to use.</param>
        /// <returns>A path to a file, which may or may not exist yet, or <c>null</c> if no location
        /// was chosen.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public static string GetFilePath(IInquiryHelper inquiryHelper, FileFilterGenerator fileFilterGenerator)
        {
            if (inquiryHelper == null)
            {
                throw new ArgumentNullException(nameof(inquiryHelper));
            }

            if (fileFilterGenerator == null)
            {
                throw new ArgumentNullException(nameof(fileFilterGenerator));
            }

            return(inquiryHelper.GetTargetFileLocation(fileFilterGenerator.Filter, null));
        }
コード例 #2
0
ファイル: ProjectMigrator.cs プロジェクト: Deltares/Riskeer
        public string DetermineMigrationLocation(string originalFilePath)
        {
            if (originalFilePath == null)
            {
                throw new ArgumentNullException(nameof(originalFilePath));
            }

            ValidateProjectPath(originalFilePath, nameof(originalFilePath), Resources.ProjectMigrator_Source_Descriptor);

            string suggestedFileName = GetSuggestedFileName(originalFilePath);
            string migrationLocation = inquiryHelper.GetTargetFileLocation(fileFilter.Filter, suggestedFileName);

            if (migrationLocation == null)
            {
                GenerateMigrationCancelledLogMessage(originalFilePath);
            }

            return(migrationLocation);
        }
コード例 #3
0
 /// <summary>
 /// Prompts a new <see cref="SaveFileDialog"/> to select a location for saving the project file.
 /// </summary>
 /// <param name="projectName">A string containing the file name selected in the file dialog box.</param>
 /// <returns>The selected project file, or <c>null</c> otherwise.</returns>
 private string OpenProjectSaveFileDialog(string projectName)
 {
     return(inquiryHelper.GetTargetFileLocation(projectPersister.SaveProjectFileFilter, projectName));
 }