public ViewModel() { CreateDatabaseCommand = new DelegateCommand(CreateDatabase); CreateIndexCommand = new DelegateCommand(() => indexManager.CreateIndex("Practice")); WhereQueryCommand = new DelegateCommand(IndexedQuery); SequentialWhereQueryCommand = new DelegateCommand(SequentialQuery); CountQueryCommand = new DelegateCommand(() => CountQuery("London")); PeppermintQueryCommand = new DelegateCommand(() => AverageQuery("Peppermint Oil")); PostcodesQueryCommand = new DelegateCommand(PostcodeQuery); RegionAverageQueryCommand = new DelegateCommand(RegionQuery); fileSystemScanner = new FileSystemScanner(); indexManager = new IndexManager(fileSystemScanner); DatabaseCreated = fileSystemScanner.DatabaseExists("orders"); IndexOn = String.Join(", ", indexManager.AvailableIndices()); }
public IndexManager(FileSystemScanner fileSystemScanner) { indices.AddRange( fileSystemScanner.FilesMatching("^index_[a-zA-Z]*.dat$") .Select(name => name.Split('_')[1].Split('.')[0])); }