Пример #1
0
        /// <summary>
        /// This method parses the stimulus file names in the import for
        /// forbidden characters like white space, and shows a notification.
        /// </summary>
        /// <returns><strong>True</strong>, if filenames are valid,
        /// otherwise <strong>false</strong>.</returns>
        private bool CheckforValidFilenames()
        {
            int fileErrorCounter = 0;

            foreach (string filename in this.detectionSetting.TrialIDToImageAssignments.Values)
            {
                if (!IOHelpers.IsValidFilename(filename))
                {
                    fileErrorCounter++;
                }
            }

            if (fileErrorCounter > 0)
            {
                string message = "It seems that at least " + fileErrorCounter.ToString() + " stimulus filenames are not valid, "
                                 + Environment.NewLine + " because they contain white-space "
                                 + " or other unallowed characters." + Environment.NewLine
                                 + "Would you like to revise the names ?";
                if (InformationDialog.Show("Invalid filename", message, true, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    return(false);
                }
            }

            return(true);
        }