Пример #1
0
        private void _selectFile()
        {
            int    pointsToGain     = 0;
            string selectedFilePath = _files[new Random().Next(_files.Count)];

            if (File.Exists(selectedFilePath))
            {
                pointsToGain = PointsCalculator.CalculatePointsForFile(new FileInfo(selectedFilePath));
            }
            else if (Directory.Exists(selectedFilePath))
            {
                pointsToGain = PointsCalculator.CalculatePointsForDirectory(new DirectoryInfo(selectedFilePath));
            }
            else
            {
                throw new Exception("File path selected for deletion is not recognized as a File or Directory");
            }

            lblFileName.Content    = selectedFilePath;
            lblScoreToGain.Content = pointsToGain;
        }