public void loadFiles() { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Image files (*.jpg, *.jpeg, *.png, *.bmp, *.gif)|*.jpg;*.jpeg;*.png;*.bmp;*.gif"; dialog.Title = "Load images to the new category..."; dialog.Multiselect = true; if (dialog.ShowDialog() == DialogResult.OK) { int categoryId = categoryIndex++; IFileCategory category = new FileCategory(); category.SetId(categoryId); category.SetName("Category " + categoryId); IFileList fileList = new FileList(); int fileId = 0; foreach (String filePath in dialog.FileNames) { IFile file = new File(); file.SetPath(filePath); file.SetId(fileId++); fileList.AddFile(file); } category.SetFileList(fileList); _categoriesList.AddCategory(category); } }