/// <summary>
        /// Populates the list box containing the names of the images
        /// </summary>
        private void PopulateFileList( )
        {
            lbImageFiles.Items.Clear( );

            ImageFileList fileList   = new ImageFileList(tbImagePath.Text, ".bmp|.jpg|.png");
            List <string> imageFiles = fileList.GenerateFileList( );

            if (imageFiles.Count > 0)
            {
                for (int x = 0; x < imageFiles.Count; x++)
                {
                    lbImageFiles.Items.Add(System.IO.Path.GetFileName(imageFiles[x]));
                }
            }
        }
Exemplo n.º 2
0
        private void FillInList(FileType fileType, string stringToParse)
        {
            switch (fileType)
            {
            case FileType.Text:
                TextFileList.Add(new TextFile(stringToParse));
                break;

            case FileType.Image:
                ImageFileList.Add(new ImageFile(stringToParse));
                break;

            default:
                MovieFileList.Add(new MovieFile(stringToParse));
                break;
            }
        }
Exemplo n.º 3
0
        public void PrintFileList()
        {
            if (TextFileList.Any())
            {
                Console.WriteLine(FileType.Text + "files:");

                var sortedList = TextFileList.OrderBy(d => d.SizeInBytes);

                foreach (var file in sortedList)
                {
                    file.Print();
                }
            }

            if (ImageFileList.Any())
            {
                Console.WriteLine(FileType.Image + "files:");

                var sortedList = ImageFileList.OrderBy(d => d.SizeInBytes);

                foreach (var file in sortedList)
                {
                    file.Print();
                }
            }

            if (MovieFileList.Any())
            {
                Console.WriteLine(FileType.Movie + "files:");

                var sortedList = MovieFileList.OrderBy(d => d.SizeInBytes);

                foreach (var file in sortedList)
                {
                    file.Print();
                }
            }

            Console.ReadKey();
        }