Ejemplo n.º 1
0
        public AccountsViewModel(
            IUserService userService,
            IAttachmentService attachmentService,
            ICommandFactory commandFactory,
            IMessenger messenger,
            IFileProcessor fileProcessor)
        {
            this.userService       = userService;
            this.attachmentService = attachmentService;
            this.messenger         = messenger;
            this.fileProcessor     = fileProcessor;

            AddButtonClick          = commandFactory.Create(OnAddButtonClick);
            EditButtonClick         = commandFactory.Create(OnEditButtonClick);
            DeleteButtonClick       = commandFactory.Create(OnDeleteButtonClick);
            AttachmentsButtonClick  = commandFactory.Create(OnAttachmentsButtonClick);
            WatchButtonMouseDown    = commandFactory.Create(OnWatchButtonMouseDown);
            WatchButtonMouseUp      = commandFactory.Create(OnWatchButtonMouseUp);
            PasswordCopyButtonClick = commandFactory.Create(OnPasswordCopyButtonClick);
            LoginCopyButtonClick    = commandFactory.Create(OnLoginCopyButtonClick);
            SearchReset             = commandFactory.Create(OnSearchReset);
            MenuButtonClick         = commandFactory.Create(OnMenuButtonClick);
            DragEnter = commandFactory.Create(OnDragEnter);
            DragLeave = commandFactory.Create(OnDragLeave);
            FileDrop  = commandFactory.Create(
                (obj) =>
            {
                fileProcessor.ProcessFiles(obj as string[]);
                IsDragOver = false;
            });
        }
        public AttachmentsViewModel(
            IAttachmentService attachmentService,
            ICommandFactory commandFactory,
            IMessenger messenger,
            IFolderBrowserDialogAdapter folderDialog,
            IFileProcessor fileProcessor)
        {
            this.attachmentService = attachmentService;
            this.messenger         = messenger;
            this.folderDialog      = folderDialog;
            this.fileProcessor     = fileProcessor;
            this.fileProcessor.ProcessingFinished +=
                () => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Attachments)));

            BackButtonClick    = commandFactory.Create(OnBackButtonClick);
            ExtractButtonClick = commandFactory.Create(OnExtractButtonClick);
            DeleteButtonClick  = commandFactory.Create(OnDeleteButtonClick);
            DragEnter          = commandFactory.Create(OnDragEnter);
            DragLeave          = commandFactory.Create(OnDragLeave);
            FileDrop           = commandFactory.Create(
                async(obj) =>
            {
                await fileProcessor.ProcessFiles(obj as string[]).ConfigureAwait(false);
                IsDragOver = false;
            });
        }
        private void HandleFile(object sender, FileSystemEventArgs args)
        {
            var filePath = args.FullPath;

            if (_directoryService.TryOpen(filePath, 3))
            {
                _fileProcessor.ProcessFiles(filePath, _rules);
            }
        }
        private void HandleFile(object sender, FileSystemEventArgs args)
        {
            statusService.ServiceStatus.Status = CurerntState.ProcessFiles;

            var filePath = args.FullPath;

            if (_directoryService.TryOpen(filePath, 3))
            {
                _fileProcessor.ProcessFiles(filePath, _rules);
            }

            statusService.ServiceStatus.Status = CurerntState.WatingFiles;
        }
Ejemplo n.º 5
0
        private static void ProcessFiles(string folderPath)
        {
            IEnumerable <string> files = Directory.EnumerateFiles(folderPath);

            Console.WriteLine("Processing {0} files...", files.Count());
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            ProcessingResult result = FileProcessor.ProcessFiles(files);

            stopwatch.Stop();

            FormattedOutput(stopwatch, result);
        }