//Initialize the form, get all journals and present them as a list of checkboxs. public FilterArticlesForm(MainForm mainForm, ArticleTabPage articleTabPage) { this.mainForm = mainForm; this.articleTabPage = articleTabPage; Dictionary<string, bool> dictionary = articleTabPage.getJournalToView(); InitializeComponent(); foreach (KeyValuePair<string, bool> entry in dictionary) { journalCheckedListBox.Items.Add(entry.Key,entry.Value); } }
//Initialize the form, get all journals and present them as a list of checkboxs. public FilterArticlesForm(MainForm mainForm, ArticleTabPage articleTabPage) { this.mainForm = mainForm; this.articleTabPage = articleTabPage; Dictionary <string, bool> dictionary = articleTabPage.getJournalToView(); InitializeComponent(); foreach (KeyValuePair <string, bool> entry in dictionary) { journalCheckedListBox.Items.Add(entry.Key, entry.Value); } }
//Filter the table, shows only the articles that their journal checkbox was checked. private void saveButton_Click(object sender, EventArgs e) { Dictionary <string, bool> dic = articleTabPage.getJournalToView(); for (int i = 0; i < journalCheckedListBox.Items.Count; i++) { string str = (string)journalCheckedListBox.Items[i]; dic[str] = journalCheckedListBox.GetItemChecked(i); } articleTabPage.filterTable(); mainForm.Enabled = true; this.Close(); }