コード例 #1
0
        public void StartToSearch()
        {
            FilesDataLogic filesDataLogic = new FilesDataLogic();                              //Make new FilesDataLogic object
            int            searchID       = filesDataLogic.AddSearch(TextToSearch, Directory); // Add search to DB and get searchID from DB.
            FilesSearcher  f = new FilesSearcher(searchID);                                    //Start searching files.

            f.FoundFile      += SaveInDataBase;                                                //If file found event occure, save details in DB.
            f.FoundFile      += DisplayFoundFileMessage;                                       //If file found event occure, display details message.
            f.CatchException += DisplayExceptionMessage;                                       //If exception event occured, display details  message.

            if (Directory == null)                                                             //If directory not selected, search the entire computer
            {
                f.SearchFilesInAllComp(TextToSearch);
            }
            else             //If directory selected, search files in selected directory
            {
                f.SearchFilesInDirectory(Directory, TextToSearch);
            }
        }
コード例 #2
0
        public void SaveInDataBase(object sender, ResultEventArgs e)        //Save result in DB.
        {
            FilesDataLogic filesDataLogic = new FilesDataLogic();

            filesDataLogic.AddResult(e.StringToSearchId, e.SearchResult);
        }