예제 #1
0
        private void Edit_Details_Load_1(object sender, EventArgs e)
        {
            SaveButton.Hide();
            CancelButton.Hide();

            NewBookButton.Enabled     = true;
            SaveNewBookButton.Enabled = false;

            TitleTextBox.Text         = BookSearchMain.passtitle;
            AuthorTextBox.Text        = BookSearchMain.passauthor;
            PublisherTextBox.Text     = BookSearchMain.passpublisher;
            BookTypeListBox.Text      = BookSearchMain.passbooktype;
            PriceTextBox.Text         = BookSearchMain.passprice;
            EditionTextBox.Text       = BookSearchMain.passedition;
            YearPublishedTextBox.Text = BookSearchMain.passyearpublished;
            QuantityTextBox.Text      = BookSearchMain.passquantity;
            BookIDLabelBox.Text       = BookSearchMain.passbookID;

            TitleTextBox.Enabled         = false;
            AuthorTextBox.Enabled        = false;
            PublisherTextBox.Enabled     = false;
            BookTypeListBox.Enabled      = false;
            PriceTextBox.Enabled         = false;
            EditionTextBox.Enabled       = false;
            YearPublishedTextBox.Enabled = false;
            QuantityTextBox.Enabled      = false;
        }
예제 #2
0
 //Show Item TextBox on DoubleClick
 private void companyDataGridView_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     nameTextBox.Text = companyDataGridView.CurrentRow.Cells[0].Value.ToString();
     companny.OldName = nameTextBox.Text;
     UpdateButton.Show();
     UpdateButton.Location = new Point(369, 86);
     SaveButton.Hide();
 }
예제 #3
0
 private void CancelCreatingButton_Click(object sender, EventArgs e)
 {
     gridIm.SolvingAllowed = false;
     editingOn             = false;
     SetSideButtonsEnabled(true);
     SaveButton.Hide();
     CancelCreatingButton.Hide();
     SaveButton.Text    = "Save";
     SaveButton.Enabled = true;
     ResetPicDir();
 }
예제 #4
0
        private async void SaveAsync()
        {
            bool res = false;

            editingOn             = false;
            SaveButton.Text       = "Solving";
            SaveButton.Enabled    = false;
            gridIm.SolvingAllowed = true;

            await Task.Run(() =>
            {
                res = gridIm.Solve();
            });

            if (gridIm.SolvingAllowed)
            {
                if (!res)
                {
                    MessageBox.Show(russian ? "Данную сетку невозможно решить" : "This grid is unsolvable", "Circular Route");
                    editingOn          = true;
                    SaveButton.Text    = "Save";
                    SaveButton.Enabled = true;
                    return;
                }
                GridPanel.BringToFront();
                UpdateGridPanel();

                using (SaveFileDialog sf = new SaveFileDialog())
                {
                    sf.FileName = "grid";
                    sf.Filter   = "Grid direction file (*.crdir)|*.crdir";
                    if (sf.ShowDialog() == DialogResult.OK)
                    {
                        gridIm.SaveDirections(sf.FileName);
                        MessageBox.Show(russian ? "Сохранено!" : "Saved", "Circular Route");
                        editingOn = false;
                        SetSideButtonsEnabled(true);

                        SaveButton.Hide();
                        CancelCreatingButton.Hide();

                        ResetPicDir();
                    }
                    else
                    {
                        DirPanel.BringToFront();
                        editingOn = true;
                    }
                    SaveButton.Text    = "Save";
                    SaveButton.Enabled = true;
                }
            }
        }
 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();
 }
        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");
            }
        }
예제 #7
0
        /// <summary>
        /// Initializes the form
        /// </summary>
        /// <param name="side">The side of the grid</param>
        /// <param name="russian">True if the text should be in russian</param>
        public void Initialize(int side, bool russian)
        {
            CenterToScreen();

            gameActive = false;
            editingOn  = false;
            SetSideButtonsEnabled(true);

            this.russian = russian;
            this.side    = side;
            ResetTimer();

            if (side == 6)
            {
                Size = new Size(816 + 10, 489 + 10);
            }
            else
            {
                Size = new Size(926 + 10, 579 + 10);
            }

            UpdateName();

            if (russian)
            {
                CreateGridButton.Text    = "Создать свое поле";
                LoadGridButton.Text      = "Загрузить";
                RandomButton.Text        = "Случайное поле";
                ChangeNameButton.Text    = "Поменять имя";
                LeaderboardsButton.Text  = "Рекорды";
                CloseButton.Text         = "Закрыть";
                ControlTipLabel.Text     = "Подсказка управления:\nВы можете использовать кнопки направления на вашей клавиатуре или кнопки снизу чтобы выстраивать ваш маршрут.";
                GiveUpButton.Text        = "Сдаться";
                CancelSolvingButton.Text = "Отмена";
            }
            else
            {
                CreateGridButton.Text    = "Create your grid";
                LoadGridButton.Text      = "Load";
                RandomButton.Text        = "Solve random";
                ChangeNameButton.Text    = "Change Name";
                LeaderboardsButton.Text  = "Leaderoards";
                CloseButton.Text         = "Close";
                ControlTipLabel.Text     = "Control tip:\nYou can use the arrow keys on your keyboard or the arrow buttons down below to navigate your route.";
                GiveUpButton.Text        = "Give up";
                CancelSolvingButton.Text = "Cancel";
            }



            try
            {
                leaders6 = PlayerInfo.Load(leaderboards6Path);
            }
            catch (IOException)
            {
                leaders6 = new List <PlayerInfo>
                {
                    new PlayerInfo("Bob", 6, 300)
                };
                PlayerInfo.Save(leaders6, leaderboards6Path);
            }

            try
            {
                leaders8 = PlayerInfo.Load(leaderboards8Path);
            }
            catch (IOException)
            {
                leaders8 = new List <PlayerInfo>
                {
                    new PlayerInfo("Bob", 8, 600)
                };
                PlayerInfo.Save(leaders8, leaderboards8Path);
            }


            SetArrowButtonsEnabled(false);

            SaveButton.Hide();
            CancelCreatingButton.Hide();
            CancelSolvingButton.Hide();
            GiveUpButton.Hide();


            FillPanel();
            ShowDialog();
        }