Ejemplo n.º 1
0
        public ResizeViewModel(IResizeService resizeService)
        {
            if(resizeService == null)
                throw new ArgumentNullException("resizeService");

            resizedImages = resizeService.RetrieveResizedImages();
            saveSourceImage = true;
        }
Ejemplo n.º 2
0
 public PhotoController(IGetPhotoService getPhotoService, IResizeService resizer, IDeleteService deleteService,
                        IAddPhotoService indexService)
 {
     _getPhotoService = getPhotoService;
     _resizer         = resizer;
     _deleteService   = deleteService;
     _indexService    = indexService;
 }
        public ResizePageViewModel(IDragDropService dragDrop, IShareService shareService,
                                   IResizeService resizeService, IPageDialogService pageDialogService, IProgressBarDialogService progressBar,
                                   IFileSystemPermissionDialogService fileSystemPermissionDialogService, IApplicationService applicationService, IImageFileService imageFileService, ILocalSettings <ResizeSettings> localSettings,
                                   ILoggerService loggerService, ObservableCollection <ImageFile> selectedFiles,
                                   INavigationService navigationService, IResourceService resourceLoader, AppStartType appStartType) : base(loggerService)
        {
            try
            {
                _appStartType = appStartType;
                _fileSystemPermissionDialogService = fileSystemPermissionDialogService;
                _dragDropService = dragDrop;
                _shareService    = shareService;
                _resizeService   = resizeService;
                _localSettings   = localSettings;
                _localSettings.Settings.PropertyChanged += Settings_PropertyChanged;
                _pageDialogService        = pageDialogService;
                _progressBarDialogService = progressBar;
                _applicationService       = applicationService;
                _selectedFiles            = selectedFiles;
                _resourceLoader           = resourceLoader;
                _navigationService        = navigationService;
                _loggerService            = loggerService;
                _imageFileService         = imageFileService;
                ImageFiles = new ObservableCollection <ImageFile>();

                if (_selectedFiles != null)
                {
                    ImageFiles = _selectedFiles;
                }
                //get settings
                LoadSettings();

                if (IsShareTarget)
                {
                    OverwriteFiles = false;
                }

                //update preview
                ApplyPreviewDimensions();
                PropertyChanged += ResizePageViewModel_PropertyChanged;
                _loggerService?.LogEvent(nameof(ResizePageViewModel));
            }
            catch (Exception e)
            {
                _loggerService?.LogException(nameof(ResizePageViewModel), e);
            }
        }
        public ResizeCommandsViewModel(IResizeViewModel resizeViewModel, IResizeService resizeService)
        {
            if(resizeViewModel == null)
                throw new ArgumentNullException("resizeViewModel");

            if(resizeService == null)
                throw new ArgumentNullException("resizeService");

            this.resizeViewModel = resizeViewModel;
            this.resizeService = resizeService;
            resizeFileCommand = new DelegateCommand(Resize, CanResize);
            resizeFolderCommand = new DelegateCommand(ResizeFolder, CanResize);

            Observable.FromEventPattern<PropertyChangedEventArgs>(this.resizeViewModel, "PropertyChanged")
                .Subscribe(x =>
                {
                    resizeFileCommand.RaiseCanExecuteChanged();
                    resizeFolderCommand.RaiseCanExecuteChanged();
                });
        }