Ejemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            //if (sender != Timp)
            //  return;

            if (TimeLeft > 0)
            {
                TimeLeft--;
                TimeLabel.Text = (TimeLeft / 60).ToString() + ":" + (TimeLeft % 60).ToString();
                return;
            }

            if (quizController.Quiz.Corecte >= 22)
            {
                IntrebareTextBox.Text = "Timpul a expirat! Ai trecut!";
            }
            else
            {
                IntrebareTextBox.Text = "Timpul a expirat! Ai picat!";
            }

            NextButton.Hide();
            DeleteAnswersButton.Hide();
            AddQuestionButton.Show();
            Timp.Stop();
        }
Ejemplo n.º 2
0
 public Form1()
 {
     InitializeComponent();
     ResetButton.Hide();
     NextButton.Hide();
     DeleteAnswersButton.Hide();
 }
        private void Next_Click(object sender, EventArgs e)
        {
            displayBatch++;
            DisplayResult(results, ranked_docs, displayBatch);
            PreviousButton.Show();

            if (displayBatch >= results.TotalHits / 10)
            {
                NextButton.Hide();
            }
        }
Ejemplo n.º 4
0
 private void MenuButton_Click(object sender, EventArgs e)
 {
     TimeLabel.Hide();
     NextButton.Hide();
     AddQuestionButton.Show();
     StartButton.Show();
     ResetButton.Hide();
     IDLabel.Show();
     IDTextField.Show();
     DeleteAnswersButton.Hide();
     Timp.Stop();
 }
 public MainSearchForm()
 {
     InitializeComponent();
     TitleBoostBox.Enabled      = false;
     AuthorBoostBox.Enabled     = false;
     BibliBoostBox.Enabled      = false;
     AbstractBoostBox.Enabled   = false;
     LoadDatabaseButton.Enabled = false;
     TitleBoostBox.Text         = "1.0";
     AuthorBoostBox.Text        = "1.0";
     BibliBoostBox.Text         = "1.0";
     AbstractBoostBox.Text      = "1.0";
     PreviousButton.Hide();
     NextButton.Hide();
     SaveButton.Hide();
     DisplayItenButton.Hide();
 }
Ejemplo n.º 6
0
        protected void ShowHideButtons()
        {
            if (PageIndex > 0)
            {
                PreviousButton.Show();
            }
            else
            {
                PreviousButton.Hide();
            }

            if (PageIndex < (Pages.Count - 1))
            {
                NextButton.Show();
                FinishButton.Hide();
            }
            else
            {
                NextButton.Hide();
                FinishButton.Show();
            }
        }
        private void SearchButton_Click(object sender, EventArgs e)
        {
            // Check if the document has already indexed
            if (indexingState == true)
            {
                // Check if the query is empty
                if (!(QueryEnter.Text == ""))
                {
                    // Determine whether the query should be remain orginal form
                    if (PhraseFormCheckbox.Checked)
                    {
                        inputQuery = "\"" + QueryEnter.Text + "\"";
                    }
                    else
                    {
                        inputQuery = QueryEnter.Text;
                    }

                    searching = new SearchingClass();
                    stopwatch = new Stopwatch();

                    // Search the query against the index, the default return size is set to be 30
                    // retrieve the searching result TopDocs object
                    stopwatch.Restart();
                    results = searching.SearchIndex(IndexingClass.luceneIndexDirectory, IndexingClass.analyzer, inputQuery, PhraseFormCheckbox.Checked, StemCheckBox.Checked, QueryExpansionCheckBox.Checked);
                    stopwatch.Stop();

                    // Display Searching info
                    if (QueryExpansionCheckBox.Checked && wordNet.IsLoaded)
                    {
                        if (SearchingClass.finalExpandedQueryList.Count == 0)
                        {
                            FinalQueryLabel.Text = "Final query: " + string.Join(", ", SearchingClass.queryList);
                        }
                        else
                        {
                            FinalQueryLabel.Text = "Final query: " + string.Join(", ", SearchingClass.finalExpandedQueryList);
                        }
                    }
                    else
                    {
                        FinalQueryLabel.Text = "Final query: " + string.Join(", ", SearchingClass.queryList);
                    }
                    SearchingTimeLabel.Text = "Searching time: " + stopwatch.Elapsed.ToString();
                    TotalHitsLabel.Text     = "Total hits: " + results.TotalHits;

                    // Acquire the ranked documents and display the results and clean up searcher
                    ranked_docs = searching.Get_doc(results);
                    searching.ClearnUpSearcher();
                    DisplayResult(results, ranked_docs, displayBatch = 0);

                    // Only show these button when totalhits is not zero
                    if (results.TotalHits != 0)
                    {
                        DisplayItenButton.Show();
                        SaveButton.Show();
                        NextButton.Show();
                    }
                    else
                    {
                        PreviousButton.Hide();
                        NextButton.Hide();
                        SaveButton.Hide();
                        DisplayItenButton.Hide();
                    }
                }
                else
                {
                    MessageBox.Show("You need to specify your query");
                }
            }
            else
            {
                MessageBox.Show("You need to do indexing before seaching");
            }
        }
Ejemplo n.º 8
0
        private void NextButton_Click(object sender, EventArgs e)
        {
            List <string> variante = new List <string>();

            if (VariantaACheckBox.Checked)
            {
                variante.Add("a");
            }

            if (VariantaBCheckBox.Checked)
            {
                variante.Add("b");
            }

            if (VariantaCCheckBox.Checked)
            {
                variante.Add("c");
            }

            if (VariantaDCheckBox.Checked)
            {
                variante.Add("d");
            }

            if (variante.Count() == 0)
            {
                while (Visited[(QuestionNumber + 1) % 26])
                {
                    QuestionNumber++;

                    if (QuestionNumber == 26)
                    {
                        QuestionNumber = 0;
                    }
                }

                QuestionNumber++;
                DisplayQuestion(QuestionNumber);
                return;
            }

            Visited[QuestionNumber] = true;

            if (quizController.CheckAnswer(QuestionNumber, variante) == false)
            {
                quizController.Quiz.Gresite++;
                UpdateGresite();
            }
            else
            {
                quizController.Quiz.Corecte++;
                UpdateCorecte();
            }

            if (CheckIfLost())
            {
                IntrebareTextBox.Text = "AI PICAT!";
                NextButton.Hide();
                DeleteAnswersButton.Hide();
                AddQuestionButton.Show();
                IDLabel.Show();
                IDTextField.Show();
                ResetCheckBoxes();
                TimeLabel.Hide();
                return;
            }

            if (quizController.Quiz.Corecte + quizController.Quiz.Gresite == 26)
            {
                if (CheckIfPassed())
                {
                    IntrebareTextBox.Text = "AI TRECUT!";
                    NextButton.Hide();
                    DeleteAnswersButton.Hide();
                    AddQuestionButton.Show();
                    IDLabel.Show();
                    IDTextField.Show();
                    ResetCheckBoxes();
                    TimeLabel.Hide();
                    return;
                }

                if (CheckIfLost())
                {
                    IntrebareTextBox.Text = "AI PICAT!";
                    NextButton.Hide();
                    DeleteAnswersButton.Hide();
                    AddQuestionButton.Show();
                    IDLabel.Show();
                    IDTextField.Show();
                    ResetCheckBoxes();
                    TimeLabel.Hide();
                    return;
                }
            }

            ResetCheckBoxes();

            while (Visited[QuestionNumber])
            {
                QuestionNumber++;

                if (QuestionNumber == 26)
                {
                    QuestionNumber = 0;
                }
            }

            DisplayQuestion(QuestionNumber);
        }