private void keywordToolStripMenuItem_Click(object sender, EventArgs e) { if ((databaseTabs.TabPages[databaseTabs.SelectedIndex].Controls[0] as InnerForm).Locked) { MessageBox.Show("Unable to add filter due to work in progress.", "Error"); return; } using (PromptBox dlg = new PromptBox("Keyword:", "Add keyword filter", "default")) { if (dlg.ShowDialog() == DialogResult.OK) { (databaseTabs.TabPages[databaseTabs.SelectedIndex].Controls[0] as InnerForm).AddDisplayFilter("keyword-" + dlg.Data); (databaseTabs.SelectedTab.Controls[0] as InnerForm).AddFilter(Compendium.Model.Filtering.NoteFilterFactory.FilterType.KEYWORD, dlg.Data); } } }
#pragma warning disable IDE1006 // Naming Styles private void newButton_Click(object sender, EventArgs e) { String defaultTitle = "new_db(" + databaseTabs.TabPages.Count + ")"; using (PromptBox dlg = new PromptBox("New database name", "New database", defaultTitle)) { if (dlg.ShowDialog() == DialogResult.OK) { String title = dlg.Data; Console.WriteLine(title); if (File.Exists(title + ".xml")) { MessageBox.Show("Unable to use this name, database already exists in Compendium's folder.", "Error"); return; } System.IO.Directory.CreateDirectory("databases"); title = title.Equals("") ? defaultTitle : title; String filename = "databases\\" + title + ".xml"; title = checkTabTitle(title) + ".xml"; load_file(filename, title); } } }