Compare commits
2 Commits
5163c2db09
...
8fefcb9ab9
Author | SHA1 | Date |
---|---|---|
~lucidiot | 8fefcb9ab9 | |
~lucidiot | 3ee3b87ea8 |
|
@ -34,6 +34,8 @@ namespace ToeCracker {
|
|||
listBox.Items.AddRange(words);
|
||||
listBox.Dock = DockStyle.Fill;
|
||||
listBox.ContextMenuStrip = this.wordContextMenuStrip;
|
||||
// Double-clicking a word is equivalent to right click -> Look Up
|
||||
listBox.DoubleClick += lookUpToolStripMenuItem_Click;
|
||||
page.Controls.Add(listBox);
|
||||
this.tabControl.TabPages.Add(page);
|
||||
}
|
||||
|
@ -45,7 +47,7 @@ namespace ToeCracker {
|
|||
private void Search(string query) {
|
||||
this.Enabled = false;
|
||||
|
||||
Dictionary<string, string[]> results = new Dictionary<string,string[]>();
|
||||
Dictionary<string, string[]> results = new Dictionary<string, string[]>();
|
||||
try {
|
||||
results = Thesaurus.Search(query);
|
||||
} catch (WebException e) {
|
||||
|
@ -89,12 +91,14 @@ namespace ToeCracker {
|
|||
return null;
|
||||
|
||||
string word = (string)((ListBox)this.tabControl.SelectedTab.Controls[0]).SelectedItem;
|
||||
word = word.Trim();
|
||||
|
||||
if (word == null)
|
||||
return null;
|
||||
|
||||
// Ignore empty lines and subgroups. Subgroups are represented as "-- ANTONYMS --"
|
||||
word = word.Trim();
|
||||
if (word == String.Empty || word.StartsWith("-- "))
|
||||
return null;
|
||||
|
||||
|
||||
return word;
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +109,8 @@ namespace ToeCracker {
|
|||
|
||||
private void searchButton_Click(object sender, EventArgs e) {
|
||||
string query = this.searchTextBox.Text.Trim();
|
||||
if (query.Length > 0) this.Search(query);
|
||||
if (query.Length > 0)
|
||||
this.Search(query);
|
||||
}
|
||||
|
||||
private void wordContextMenuStrip_Opening(object sender, CancelEventArgs e) {
|
||||
|
|
Loading…
Reference in New Issue