Ejemplo n.º 1
0
 public DirectoryViewModel(string path)
 {
     walker                  = new FileWalker(path);
     FoundImagesAndDirs      = new ObservableCollection <Model.AbstractFSObject>(walker.JPEGImagePaths);
     CurrentDirectory        = walker.GetCurrentDirectory();
     DuplicateSortedImages   = false;
     SearchedImages          = new ObservableCollection <Model.ImageModel>();
     UpdateDirectioryCommand = new ViewModel.CustomCommand <Model.DirectoryModel>((dir) =>
     {
         FoundImagesAndDirs.Clear();
         foreach (var d in walker.ListJPEGAndDirsInDirectory(CurrentDirectory + "\\" + dir.Name))
         {
             FoundImagesAndDirs.Add(d);
         }
         CurrentDirectory = walker.GetCurrentDirectory();
     });
     SearchImagesCommand = new ViewModel.CustomCommand <string>((param) =>
     {
         SearchedImages.Clear();
         SearchedImages = new ObservableCollection <Model.ImageModel>(walker.SearchJPEGInsideDirectory(CurrentDirectory, param));
     });
     SortImagesCommand = new ViewModel.CustomCommand <string>((criterion) =>
     {
         System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
         if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             walker.GenerateSortedImages(CurrentDirectory, folderDialog.SelectedPath, criterion, DuplicateSortedImages);
         }
         CurrentDirectory = folderDialog.SelectedPath;
     });
     SetFilesDuplication = new ViewModel.CustomCommand <string>((duplicate) =>
     {
         DuplicateSortedImages = bool.Parse(duplicate);
     });
 }
Ejemplo n.º 2
0
        public MainWindow()
        {
            FolderBrowserDialog selectedFolderDialog = new FolderBrowserDialog();

            if (selectedFolderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                DirectoryViewModel = new DirectoryViewModel(selectedFolderDialog.SelectedPath);
                walker             = new FileWalker(selectedFolderDialog.SelectedPath);
                viewer             = new EXIFViewer();
                InitializeComponent();
                FoundImagesListView.DataContext = DirectoryViewModel;
            }
            else
            {
                Close();
            }
            selectedFolderDialog.Dispose();
        }