コード例 #1
0
 private void NeedsButton_Click(object sender, EventArgs e)      // Select file path after click on Select Cran Needs
 {
     myNeedsDialog.ShowDialog();
     needsPath             = myNeedsDialog.FileName;
     cranNeeds             = IndexBuildNew.ReadCranNeeds(needsPath); // Put the cran_information_need into a dictionary
     SearchBtnCran.Enabled = true;                                   // Enable search button 1
     comboBox1.Enabled     = true;
 }
コード例 #2
0
        private void searchBtnRegularClick(object sender, EventArgs e) // When clicking on search button for user free-typing
        {
            limit = 0;                                                 // Set starting result index

            if (MainSearchText.Text == "")                             // Check if the textbox is empty
            {
                MessageBox.Show("Enter something!!", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                List <Dictionary <string, string> > tempListDict = new List <Dictionary <string, string> >();                                                       // Create temporary list of dictionaries
                DateTime start = System.DateTime.Now;                                                                                                               // Searching time starts
                tempListDict = IndexBuildNew.Search_Click(MainSearchText.Text, asIsCheckBox.Checked, QECheckbox.Checked, advancedCheck.Checked, out finalQueryTxt); // Search user input texts
                DateTime end = System.DateTime.Now;                                                                                                                 // Searching time starts

                if (tempListDict.Count != 0)
                {
                    AddLog("The time for searching text was " + (end - start).Milliseconds / 1000.0 + " seconds");

                    double searchingTextTime = (end - start).Milliseconds / 1000.0;
                    //  AddLog($"The time for searching text was ({searchingTextTime}) seconds");

                    finalResultList = tempListDict;   // Assign temporary list to global variable as current 10 results
                    queryCount++;                     // Count number of query search
                    ViewData(limit, finalResultList); // View data on listview



                    if (limit + 20 - finalResultList.Count >= 10) // If no next 10 results
                    {
                        NextBtn.Enabled = false;                  // Disable next button
                    }
                    else
                    {
                        NextBtn.Enabled = true;                 // Enable next button
                    }

                    PreviousBtn.Enabled  = false;                                                                                            // Disable previous button
                    SaveResult.Enabled   = true;                                                                                             // Enable save result button
                    saveLogbtn.Enabled   = true;                                                                                             // Save Log Button on
                    FinalQueryBox.Text   = finalQueryTxt;                                                                                    // Display final query text
                    resultLab.Text       = "Result numbers:";                                                                                // Display result number label
                    resultNumLab.Text    = finalResultList.Count.ToString() + ", Time: " + (end - start).Milliseconds / 1000.0 + " seconds"; // Display result number & time
                    initailPagination    = 1;
                    totalpage            = Convert.ToInt32(Math.Ceiling((double)finalResultList.Count / 10));
                    PaginationLabel.Text = String.Format("{0}/{1}", initailPagination, totalpage);
                }
                else
                {
                    MessageBox.Show("No results were found, please try again!", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);  // Display error
                    AddLog($"No results were found, please try again!");
                }
            }
        }
コード例 #3
0
        private void BuildIndexBtnClick(object sender, EventArgs e)
        {
            DateTime start = System.DateTime.Now;                               // Indexing time starts

            IndexBuildNew.BuildIndex_Click(sourcePath, indexPath, timetoIndex); // Build index

            DateTime end = System.DateTime.Now;                                 // Indexing time ends

            //activate Search Container
            SearchContainerWrap.Enabled = true;
            timetoindexLabel.Text       = "Time to Build Index: ";
            resultBuilt.Text            = timetoIndex + " seconds";
            this.AddLog("The time to built Index was " + timetoIndex + " seconds");
        }
コード例 #4
0
        // Select directory path after click on Set Index Directory
        private void SaveResult_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.DocIDBox.Text) && char.IsLetter(this.DocIDBox.Text, 0))
            {
                MessageBox.Show("Please Enter DOC ID!!", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.DocIDBox.Focus();
            }
            else
            {
                SaveDialog.FileName    = "result.txt";
                this.SaveDialog.Filter = "Text File | *.txt";
                if (this.SaveDialog.ShowDialog() == DialogResult.OK)
                {
                    DocIDText = DocIDBox.Text;

                    this.savePath = this.SaveDialog.FileName;
                    StreamWriter writer = new StreamWriter(savePath, append: true);
                    IndexBuildNew.SaveClick(finalResultList, writer, queryCount, DocIDText);
                }

                Convert2Unixbtn.Enabled = true;
            }
        }
コード例 #5
0
        // Whe clicking on search button for Cran Needs

        private void SearchBtnCranclick(object sender, EventArgs e)
        {
            limit = 0;                                                                                                                                                       // Set starting result index

            DateTime start = System.DateTime.Now;                                                                                                                            // Searching time starts

            finalResultList = IndexBuildNew.Search_Click(cranNeeds[comboBox1.SelectedItem.ToString()], false, QECheckbox.Checked, advancedCheck.Checked, out finalQueryTxt); // Search Cran needs texts
            DateTime end = System.DateTime.Now;                                                                                                                              // Searching time starts

            AddLog("The time for searching text was " + (end - start).Milliseconds / 1000.0 + " seconds");

            ViewData(limit, finalResultList);    // View data on listview
            IndexBuildNew.Create_BaseLine_Results(cranNeeds);



            if (limit + 20 - finalResultList.Count >= 10) // If no next 10 results
            {
                NextBtn.Enabled = false;                  // Disable next button
            }
            else
            {
                NextBtn.Enabled = true;                                                                                             // Enable next button
            }
            PreviousBtn.Enabled = false;                                                                                            // Disable previous button
            SaveResult.Enabled  = true;                                                                                             // Enable save result button
            resultLab.Text      = "Result numbers:";                                                                                // Display result number label
            FinalQueryBox.Text  = cranNeeds[comboBox1.SelectedItem.ToString()];                                                     //Print Query
            resultNumLab.Text   = finalResultList.Count.ToString() + ", Time: " + (end - start).Milliseconds / 1000.0 + " seconds"; // Display result number


            //Pagination code
            initailPagination    = 1;                                                                 //For
            totalpage            = Convert.ToInt32(Math.Ceiling((double)finalResultList.Count / 10)); //For each Page Count
            PaginationLabel.Text = String.Format("{0}/{1}", initailPagination, totalpage);
        }