Пример #1
0
 public void ExecuteNewFolderCommand(object o)
 {
     var folder = new Folder();
     folder.Initialize();
     AddChild(folder);
 }
Пример #2
0
        private static Folder ImportFromFolder(string selectedPath)
        {
            var rootDirectory = selectedPath;
            var rootFolder = new Folder();
            rootFolder.Initialize();
            rootFolder.Name = Path.GetFileNameWithoutExtension(rootDirectory);

            var directories = Directory.GetDirectories(rootDirectory);

            List<string> images;
            foreach (var directory in directories)
            {
                var folder = ImportFromFolder(directory);

                rootFolder.AddChild(folder);
            }

            images = Directory.GetFiles(rootDirectory, "*.png", SearchOption.TopDirectoryOnly).ToList();
            images.AddRange(Directory.GetFiles(rootDirectory, "*.gif", SearchOption.TopDirectoryOnly));

            foreach (var filename in images)
            {
                var imageData = CreateFromFilename(filename);
                rootFolder.AddChild(imageData);
            }
            return rootFolder;
        }