示例#1
0
        public ErrorsViewModel(IDirectorySearchHandler searchHandler)
        {
            this.Errors = new ObservableCollection <string>();
            searchHandler.Error.ObserveOn(RxApp.MainThreadScheduler).Subscribe(o => this.Errors.Add(o));

            this.Clear = ReactiveCommand.Create(() => this.Errors.Clear());
        }
示例#2
0
        public MainViewModel(IDirectorySearchHandler handler, IFolderPathProvider folderPathProvider)
        {
            this.StartSearch = ReactiveCommand.Create(() =>
            {
                var path = folderPathProvider.GetPath();
                if (string.IsNullOrWhiteSpace(path))
                {
                    return;
                }

                this.CancellationTokenSource = new CancellationTokenSource();
                handler.StartHandler(path, this.CancellationTokenSource.Token);
            });

            this.StopSearch = ReactiveCommand.Create(() =>
            {
                if (this.CancellationTokenSource == null || this.CancellationTokenSource.IsCancellationRequested)
                {
                    return;
                }

                this.CancellationTokenSource.Cancel();
            });
        }
示例#3
0
 public SeralizationHandler(IDirectorySearchHandler searchHandler, IProgresNotifier progresNotifier, ISavePathProvider savePathProvider)
 {
     this.progresNotifier  = progresNotifier;
     this.searchHandler    = searchHandler;
     this.savePathProvider = savePathProvider;
 }
示例#4
0
 public UIHandler(IDirectorySearchHandler searchHandler)
 {
     this.searchHandler = searchHandler;
     this.itemUpdated   = new Subject <Item>();
 }