Esempio n. 1
0
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            try
            {
                DatabaseEngine d = new DatabaseEngine();

                // Create the list to use as the custom source.
                var           source = new AutoCompleteStringCollection();
                List <string> terms  = d.GetSearchedTerms();
                foreach (string term in terms)
                {
                    source.Add(term);
                }
                txtSearch.AutoCompleteCustomSource = source;
                txtSearch.AutoCompleteMode         = AutoCompleteMode.Suggest;
                txtSearch.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            }
            catch (Exception) { }
        }
Esempio n. 2
0
        /// <summary>
        /// Reads all the files in the given directory and writes all tokens and file paths to the database
        /// </summary>
        public void initializeDirectory()
        {
            directoryDocuments = new List <string>();
            DBE = new DatabaseEngine();
            List <string> storedDocuments = DBE.GetDocumentPaths();

            List <Dictionary <string, List <string> > > docsToBeStored = new List <Dictionary <string, List <string> > >();

            var files = Directory.GetFiles(directory);

            foreach (var file in files)
            {
                if (!storedDocuments.Contains(file))
                {
                    docsToBeStored.Add(readFiles(file));
                }
                directoryDocuments.Add(file);
            }
            writeToDatabase(docsToBeStored);
        }