private void LoadSelectedList() { FormLoadList loadList = new FormLoadList(); if (loadList.ShowDialog() == DialogResult.OK) { dataGridViewEdit.Columns.Clear(); dataGridViewEdit.Rows.Clear(); string selection = loadList.SelectedList; foreach (string language in WinFormsHelper.Languages(selection)) { dataGridViewEdit.Columns.Add(language, language.ToUpper()); } foreach (string[] words in WinFormsHelper.AllWords(selection)) { dataGridViewEdit.Rows.Add(words); } EditButtonsSwitch(); buttonAddWord.Enabled = true; labelCurrentWordList.Text = $"Current list: {loadList.SelectedList}"; CurrentList = loadList.SelectedList; } }
public void RefreshLoadedList() { dataGridViewEdit.Columns.Clear(); dataGridViewEdit.Rows.Clear(); foreach (string language in WinFormsHelper.Languages(CurrentList)) { dataGridViewEdit.Columns.Add(language, language.ToUpper()); } foreach (string[] words in WinFormsHelper.AllWords(CurrentList)) { dataGridViewEdit.Rows.Add(words); } }
private void listBoxLists_SelectedIndexChanged(object sender, EventArgs e) { if (listBoxList.Items.Count != 0) { buttonDeleteList.Enabled = true; buttonLoadList.Enabled = true; } labelWordCount.Visible = true; labelWordCount.Text = $"Word count: {WinFormsHelper.Count(listBoxList.GetItemText(listBoxList.SelectedItem))}"; listBoxLanguage.Items.Clear(); foreach (string language in WinFormsHelper.Languages(listBoxList.GetItemText(listBoxList.SelectedItem))) { listBoxLanguage.Items.Add(language.Capitalize()); } listBoxLanguage.SelectedIndex = 0; }
private void FormAddWord_Shown(object sender, EventArgs e) { string selection = parentFormWordList.CurrentList; dataGridView.TopLeftHeaderCell.Value = "LANGUAGE"; dataGridView.Columns.Add("WORD", "WORD"); int rowTotalHeight = 0; foreach (string language in WinFormsHelper.Languages(selection)) { DataGridViewRow row = new DataGridViewRow(); row.HeaderCell.Value = language.ToUpper(); dataGridView.Rows.Add(row); rowTotalHeight += row.Height; } Height = rowTotalHeight + (138 - 44) + dataGridView.ColumnHeadersHeight; }
public void LoadNewList(FormNewList newList) { dataGridViewEdit.Columns.Clear(); dataGridViewEdit.Rows.Clear(); string selection = newList.SelectedList; foreach (string language in WinFormsHelper.Languages(selection)) { dataGridViewEdit.Columns.Add(language, language.ToUpper()); } foreach (string[] words in WinFormsHelper.AllWords(selection)) { dataGridViewEdit.Rows.Add(words); } practiceToolStripMenuItem.Enabled = true; EditButtonsSwitch(); labelCurrentWordList.Text = $"Current list: {newList.SelectedList}"; CurrentList = newList.SelectedList; }