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); }); }
void ReleaseDesignerOutlets() { if (listTableView != null) { listTableView.Dispose(); listTableView = null; } if (NewListButton != null) { NewListButton.Dispose(); NewListButton = null; } if (ProfileButton != null) { ProfileButton.Dispose(); ProfileButton = null; } }