Exemplo n.º 1
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     if (listBox1.SelectedItem == null)
     {
         TranslationGrid.Hide();
         InformationBox.Text = "You need to select a list before you save";
         InformationBox.Show();
     }
     else
     {
         Save();
     }
 }
Exemplo n.º 2
0
        private void MainForm_Activated(object sender, EventArgs e)
        {
            listBox1.Show();
            listBox1.Enabled = true;
            ListLabel.Show();
            listBox1.Items.Clear();
            TranslationGrid.Hide();
            var listsOnComputer = WordList.GetLists();

            foreach (var lists in listsOnComputer)
            {
                var wordList = WordList.LoadList(lists);
                if (wordList != null && wordList.Languages.Length > 1)
                {
                    listBox1.Items.Add(lists);
                }
            }
        }
Exemplo n.º 3
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox1.SelectedItem == null)
            {
                TranslationGrid.Hide();
                InformationBox.Show();
                InformationBox.Text = "this is not a valid list";
                return;
            }

            FileName = listBox1.SelectedItem.ToString();
            var wordList = WordList.LoadList(FileName);

            if (wordList == null)
            {
                return;
            }
            TranslationGrid.Show();
            AddButton.Show();
            NewListButton.Show();
            RemoveButton.Show();
            SaveButton.Show();
            PracticeButton.Show();
            AddButton.Enabled    = true;
            SaveButton.Enabled   = true;
            RemoveButton.Enabled = true;
            InformationBox.Hide();
            var languageArray = wordList.Languages;
            var sortBy        = 0;

            CountLabel.Text = $"There are {wordList.Count()} words in the list";
            TranslationGrid.Rows.Clear();
            TranslationGrid.Columns.Clear();
            TranslationGrid.Refresh();
            foreach (var languages in languageArray)
            {
                TranslationGrid.Columns.Add("newColumnName", languages.ToUpper());
            }
            TranslationGrid.Rows.Clear();

            wordList.List(sortBy, x => { TranslationGrid.Rows.Add(x); });
        }
Exemplo n.º 4
0
        private void PracticeButton_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedItem == null)
            {
                return;
            }
            listBox1.Enabled = false;
            var name = listBox1.SelectedItem.ToString();

            if (WordList.LoadList(name).Count() != 0)
            {
                var practice = new PracticeForm(name);
                TranslationGrid.Hide();
                practice.TopMost = true;
                practice.Show();
            }
            else
            {
                var caption = "Error Detected";
                var message = "The selected list is empty, you cant practice with an empty list";
                var buttons = MessageBoxButtons.OK;
                MessageBox.Show(message, caption, buttons);
            }
        }