コード例 #1
0
        public MainWindowViewModel()
        {
            var config = ServiceProvider.GetService <AppConfig>();

            _projectDirectories = ProjectCrawler.Scan(config.RootDirectories).ToArray();
            LauncherCommands    = config.Commands;

            SearchCommand = ReactiveCommand.CreateFromTask <string, List <ProjectMatchResult> >(SearchAsync);
            SearchCommand.ThrownExceptions.Subscribe();
            SearchCommand.ToPropertyEx(this, x => x.FilteredProjectDirectories);

            ExecuteLauncherCommand = ReactiveCommand.CreateFromTask <object[]>(LaunchAsync);
            ExecuteLauncherCommand.ThrownExceptions.Subscribe();

            this.WhenAnyValue(x => x.SearchTerm)
            .Throttle(TimeSpan.FromSeconds(0.25))
            .InvokeCommand(SearchCommand);
        }