Ejemplo n.º 1
0
        public OverwriteOptionsDialogViewModel(
            IFileService fileService,
            IFileSystemNodeViewModelFactory fileSystemNodeViewModelFactory,
            IFileNameGenerationService fileNameGenerationService,
            IPathService pathService)
        {
            _fileService = fileService;
            _fileSystemNodeViewModelFactory = fileSystemNodeViewModelFactory;
            _fileNameGenerationService      = fileNameGenerationService;
            _pathService = pathService;

            CancelCommand         = ReactiveCommand.Create(Close);
            SkipCommand           = ReactiveCommand.Create(Skip);
            ReplaceCommand        = ReactiveCommand.Create(Replace);
            ReplaceIfOlderCommand = ReactiveCommand.Create(ReplaceIfOlder);
            RenameCommand         = ReactiveCommand.Create(Rename);
        }
    public OverwriteOptionsDialogViewModel(
        IFileService fileService,
        IFileSystemNodeViewModelFactory fileSystemNodeViewModelFactory,
        IFileNameGenerationService fileNameGenerationService,
        IPathService pathService)
    {
        _fileService = fileService;
        _fileSystemNodeViewModelFactory = fileSystemNodeViewModelFactory;
        _fileNameGenerationService      = fileNameGenerationService;
        _pathService = pathService;

        SkipCommand           = ReactiveCommand.Create(Skip);
        ReplaceCommand        = ReactiveCommand.Create(Replace);
        ReplaceIfOlderCommand = ReactiveCommand.Create(ReplaceIfOlder);

        var canRename = this.WhenAnyValue(x => x.NewFileName,
                                          (Func <string, bool>)(_ => CheckIfDestinationNotExists()));

        RenameCommand = ReactiveCommand.Create(Rename, canRename);
    }