コード例 #1
0
        public CreateArchiveDialogViewModel(
            IDirectoryService directoryService,
            IFileService fileService,
            IArchiveTypeViewModelFactory archiveTypeViewModelFactory,
            ISystemDialogService systemDialogService,
            ICreateArchiveStateService createArchiveStateService)
        {
            _directoryService            = directoryService;
            _fileService                 = fileService;
            _archiveTypeViewModelFactory = archiveTypeViewModelFactory;
            _systemDialogService         = systemDialogService;
            _createArchiveStateService   = createArchiveStateService;
            _availableArchiveTypes       = new ObservableCollection <ArchiveTypeViewModel>();

            this.WhenAnyValue(x => x.SelectedArchiveType)
            .Buffer(2, 1)
            .Select(b => (Previous: b[0], Current: b[1]))
            .Subscribe(values => ArchivePath = GetUpdatedArchivePath(values.Previous, values.Current));
            var canCreate = this.WhenAnyValue(x => x.ArchivePath,
                                              CheckIfPathIsValid);

            SelectPathCommand = ReactiveCommand.CreateFromTask(SelectPathAsync);
            CreateCommand     = ReactiveCommand.Create(CreateArchive, canCreate);
            CancelCommand     = ReactiveCommand.Create(Close);

            ArchivePath = string.Empty;
        }
コード例 #2
0
 public NodeViewModel(
     IFileSystemNodeOpeningBehavior fileSystemNodeOpeningBehavior,
     IOperationsService operationsService,
     IClipboardOperationsService clipboardOperationsService,
     IFilesOperationsMediator filesOperationsMediator,
     IFileSystemNodePropertiesBehavior fileSystemNodePropertiesBehavior,
     IDialogService dialogService,
     ITrashCanService trashCanService,
     IArchiveService archiveService,
     ISystemDialogService systemDialogService,
     IOpenWithApplicationService openWithApplicationService,
     IPathService pathService)
     : base(
         fileSystemNodeOpeningBehavior,
         operationsService,
         clipboardOperationsService,
         filesOperationsMediator,
         fileSystemNodePropertiesBehavior,
         dialogService,
         trashCanService,
         archiveService,
         systemDialogService,
         openWithApplicationService,
         pathService)
 {
 }
コード例 #3
0
 public FileSystemNodeViewModelFactory(
     IFileSystemNodeOpeningBehavior fileOpeningBehavior,
     IFileSystemNodeOpeningBehavior directoryOpeningBehavior,
     IFileSizeFormatter fileSizeFormatter,
     IPathService pathService,
     IOperationsService operationsService,
     IClipboardOperationsService clipboardOperationsService,
     IFilesOperationsMediator filesOperationsMediator,
     IFileSystemNodePropertiesBehavior filePropertiesBehavior,
     IFileSystemNodePropertiesBehavior directoryPropertiesBehavior,
     IDialogService dialogService,
     ITrashCanService trashCanService,
     IFileService fileService,
     IDirectoryService directoryService,
     IArchiveService archiveService,
     ISystemDialogService systemDialogService,
     IOpenWithApplicationService openWithApplicationService)
 {
     _fileOpeningBehavior      = fileOpeningBehavior;
     _directoryOpeningBehavior = directoryOpeningBehavior;
     _fileSizeFormatter        = fileSizeFormatter;
     _pathService                 = pathService;
     _operationsService           = operationsService;
     _clipboardOperationsService  = clipboardOperationsService;
     _filesOperationsMediator     = filesOperationsMediator;
     _filePropertiesBehavior      = filePropertiesBehavior;
     _directoryPropertiesBehavior = directoryPropertiesBehavior;
     _dialogService               = dialogService;
     _trashCanService             = trashCanService;
     _fileService                 = fileService;
     _directoryService            = directoryService;
     _archiveService              = archiveService;
     _systemDialogService         = systemDialogService;
     _openWithApplicationService  = openWithApplicationService;
 }
コード例 #4
0
ファイル: MainViewModel.cs プロジェクト: savaged/Confidant
        public MainViewModel(
            IDispatcherHelper dispatcherHelper,
            ISystemDialogService dialogService,
            string productVersion)
        {
            ProductVersion = productVersion;

            _dispatcherHelper = dispatcherHelper;

            _dialogService = dialogService;

            _propertiesService = new CachedPropertiesService(
                "ConfidantWpf.props");
            _dataFileLocation = _propertiesService
                                .Get(nameof(DataFileLocation))?.ToString();
            if (string.IsNullOrEmpty(_dataFileLocation))
            {
                _dataFileLocation =
                    Path.GetFullPath(
                        Environment.GetFolderPath(
                            Environment.SpecialFolder.MyDocuments) +
                        $"/confidant.dat");
            }
            Index = new ObservableCollection <string>();

            GeneratePasswordCmd = new RelayCommand(
                OnGeneratePassword, () => CanGeneratePassword);
            FileCmd          = new RelayCommand(OnFile, () => CanFile);
            SearchCmd        = new RelayCommand(OnSearch, () => CanSearch);
            DeleteCmd        = new RelayCommand(OnDelete, () => CanDelete);
            SaveCmd          = new RelayCommand(OnSave, () => CanSave);
            ResetPasswordCmd = new RelayCommand(
                OnResetPassword, () => CanResetPassword);
            NewCmd       = new RelayCommand(OnNew, () => CanAddNew);
            ClearFormCmd = new RelayCommand(
                OnClearForm, () => CanClearForm);

            _timer = new Timer(120000)
            {
                AutoReset = true
            };
            _timer.Elapsed += OnTimerIntervalElapsed;

            PropertyChanged += OnPropertyChanged;
        }
コード例 #5
0
 public FileSystemNodeFacade(
     IOperationsService operationsService,
     IClipboardOperationsService clipboardOperationsService,
     IFilesOperationsMediator filesOperationsMediator,
     IDialogService dialogService,
     ITrashCanService trashCanService,
     IArchiveService archiveService,
     ISystemDialogService systemDialogService,
     IOpenWithApplicationService openWithApplicationService,
     IPathService pathService)
 {
     _operationsService          = operationsService;
     _clipboardOperationsService = clipboardOperationsService;
     _filesOperationsMediator    = filesOperationsMediator;
     _dialogService              = dialogService;
     _trashCanService            = trashCanService;
     _archiveService             = archiveService;
     _systemDialogService        = systemDialogService;
     _openWithApplicationService = openWithApplicationService;
     _pathService = pathService;
 }
コード例 #6
0
        protected FileSystemNodeViewModelBase(
            IFileSystemNodeOpeningBehavior fileSystemNodeOpeningBehavior,
            IOperationsService operationsService,
            IClipboardOperationsService clipboardOperationsService,
            IFilesOperationsMediator filesOperationsMediator,
            IFileSystemNodePropertiesBehavior fileSystemNodePropertiesBehavior,
            IDialogService dialogService,
            ITrashCanService trashCanService,
            IArchiveService archiveService,
            ISystemDialogService systemDialogService,
            IOpenWithApplicationService openWithApplicationService,
            IPathService pathService)
        {
            _fileSystemNodeOpeningBehavior    = fileSystemNodeOpeningBehavior;
            _operationsService                = operationsService;
            _clipboardOperationsService       = clipboardOperationsService;
            _filesOperationsMediator          = filesOperationsMediator;
            _fileSystemNodePropertiesBehavior = fileSystemNodePropertiesBehavior;
            _dialogService              = dialogService;
            _trashCanService            = trashCanService;
            _archiveService             = archiveService;
            _systemDialogService        = systemDialogService;
            _openWithApplicationService = openWithApplicationService;
            _pathService = pathService;

            OpenCommand            = ReactiveCommand.Create(Open);
            OpenWithCommand        = ReactiveCommand.Create(OpenWithAsync);
            PackCommand            = ReactiveCommand.CreateFromTask(PackAsync);
            ExtractCommand         = ReactiveCommand.CreateFromTask <ExtractCommandType>(ExtractAsync);
            RenameCommand          = ReactiveCommand.Create(Rename);
            RenameInDialogCommand  = ReactiveCommand.CreateFromTask(RenameInDialogAsync);
            CopyToClipboardCommand = ReactiveCommand.CreateFromTask(CopyToClipboardAsync);
            DeleteCommand          = ReactiveCommand.CreateFromTask(DeleteAsync);
            CopyCommand            = ReactiveCommand.CreateFromTask(CopyAsync);
            MoveCommand            = ReactiveCommand.CreateFromTask(MoveAsync);
            ShowPropertiesCommand  = ReactiveCommand.CreateFromTask(ShowPropertiesAsync);
        }
コード例 #7
0
        public TopOperationsViewModel(
            ITerminalService terminalService,
            IDirectoryService directoryService,
            IFilesOperationsMediator filesOperationsMediator,
            IDialogService dialogService,
            IPathService pathService,
            IArchiveService archiveService,
            INodesSelectionService nodesSelectionService,
            ISystemDialogService systemDialogService)
        {
            _terminalService         = terminalService;
            _directoryService        = directoryService;
            _filesOperationsMediator = filesOperationsMediator;
            _dialogService           = dialogService;
            _pathService             = pathService;
            _archiveService          = archiveService;
            _nodesSelectionService   = nodesSelectionService;
            _systemDialogService     = systemDialogService;

            PackCommand         = ReactiveCommand.CreateFromTask(PackAsync);
            ExtractCommand      = ReactiveCommand.Create(ExtractAsync);
            SearchCommand       = ReactiveCommand.Create(Search);
            OpenTerminalCommand = ReactiveCommand.Create(OpenTerminal);
        }