Esempio n. 1
0
        public PictureGridViewModel(IPictureRepository pictureRepository,
                                    IEventAggregator eventAggregator,
                                    IMessageDialogService modalDialog,
                                    IFileExplorerDialogService fileExplorerDialogService)
        {
            if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
            {
                return;
            }

            _pictureRepository         = pictureRepository;
            _eventAggregator           = eventAggregator;
            _modalDialog               = modalDialog;
            _fileExplorerDialogService = fileExplorerDialogService;

            _eventAggregator.GetEvent <PictureOverwrittenEvent>().Subscribe(OnPictureOverwritten);

            ArePicturesLoading = false;

            _pictures     = new ObservableCollection <Picture>();
            _filterOn     = false;
            _searchFilter = string.Empty;

            SearchCommand                       = new RelayCommand <string>(OnSearchCommand);
            EditPictureNameCommand              = new RelayCommand <Picture>(OnEditPictureNameCommand);
            EditSelectedPictureNamesCommand     = new RelayCommand <List <Picture> >(OnEditSelectedPictureNamesCommand);
            ClosePictureCommand                 = new RelayCommand <Picture>(OnClosePictureCommand);
            ClosePicturesCommand                = new RelayCommand <List <Picture> >(OnClosePicturesCommand);
            CopyPicturesCommand                 = new RelayCommand <List <Picture> >(OnCopyPicturesCommand);
            MovePicturesCommand                 = new RelayCommand <List <Picture> >(OnMovePicturesCommand);
            DeletePicturesCommand               = new RelayCommand <List <Picture> >(OnDeletePicturesCommand);
            ViewEditPicturesCommand             = new RelayCommand <List <Picture> >(OnViewEditPicturesCommand);
            PicturesListSelectionChangedCommand = new RelayCommand <int>(OnPicturesListSelectionChangedCommand);
            DropCommand = new RelayCommand <object>(OnDropCommand);
        }
Esempio n. 2
0
        public MainViewModel(IFolderTreeViewModel folderTreeViewModel,
                             Func <IPictureGridViewModel> pictureGridViewModelCreator,
                             IPictureRepository pictureRepository,
                             IFileService fileService,
                             IFileExplorerDialogService fileExplorerDialogService,
                             IEventAggregator eventAggregator)
        {
            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
            {
                return;
            }

            FolderTreeViewModel          = folderTreeViewModel;
            _pictureGridViewModelCreator = pictureGridViewModelCreator;
            _pictureRepository           = pictureRepository;
            _fileService = fileService;
            _fileExplorerDialogService = fileExplorerDialogService;

            _helpInfoText = "";

            _eventAggregator = eventAggregator;
            _eventAggregator.GetEvent <OpenPicturesFromFolderEvent>().Subscribe(OnOpenPicturesFromFolder);
            _eventAggregator.GetEvent <StatusTextUserActionEvent>().Subscribe(OnStatusTextUserAction);
            _eventAggregator.GetEvent <StatusTextHelpInfoEvent>().Subscribe(OnStatusTextHelpInfo);
            _eventAggregator.GetEvent <MovingPicturesEvent>().Subscribe(OnMovingPicturesEvent);

            PictureGridViewModels = new ObservableCollection <IPictureGridViewModel>();

            OpenFolderCommand     = new RelayCommand <SearchOption>(OnOpenFolderCommand);
            OpenFilesCommand      = new RelayCommand <object>(OnOpenFilesCommand);
            CloseFolderTabCommand = new RelayCommand <IPictureGridViewModel>(OnCloseFolderCommand);
            AboutCommand          = new RelayCommand <object>(OnAboutCommand);

            CheckCommandLine();
        }