|
|
|
@ -73,6 +73,7 @@ public partial class MainForm : Form |
|
|
|
|
this.FormClosing += new FormClosingEventHandler( this.MainForm_FormClosing ) ; |
|
|
|
|
this.Resize += new EventHandler( this.MainForm_Resize ) ; |
|
|
|
|
this.mSearchQuery.TextChanged += new EventHandler( this.SearchQuery_TextChanged ) ; |
|
|
|
|
this.mSearchQuery.KeyPress += new KeyPressEventHandler( this.SearchQuery_KeyPress ) ; |
|
|
|
|
this.mSearchQuery.KeyDown += new KeyEventHandler( this.SearchQuery_KeyDown ) ; |
|
|
|
|
this.mSearchResults.KeyPress += new KeyPressEventHandler( this.SearchResults_KeyPress ) ; |
|
|
|
|
this.mSearchResults.SelectionChanged += new EventHandler( this.SearchResults_SelectionChanged ) ; |
|
|
|
@ -338,6 +339,20 @@ public partial class MainForm : Form |
|
|
|
|
updateSearchResults( mSearchQuery.Text.Trim() ) ; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void SearchQuery_KeyPress( object sender, KeyPressEventArgs e ) |
|
|
|
|
{ |
|
|
|
|
// check how much time has passed since the last keypress |
|
|
|
|
int ch = (int) e.KeyChar ; |
|
|
|
|
if ( ch >= 32 && ch < 127 ) { |
|
|
|
|
int ttl = Program.appConfig.getIntVal( new string[]{"SearchQueryTTL"}, 5 ) ; |
|
|
|
|
if ( (DateTime.Now - mLastKeyPressTimeStamp).TotalSeconds > ttl ) { |
|
|
|
|
// it's been a while - start a new search query |
|
|
|
|
mSearchQuery.Text = "" ; |
|
|
|
|
} |
|
|
|
|
mLastKeyPressTimeStamp = DateTime.Now ; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void SearchQuery_KeyDown( object sender, KeyEventArgs e ) |
|
|
|
|
{ |
|
|
|
|
// check if there are any ChartImage's associated with the keypress |
|
|
|
@ -375,8 +390,8 @@ public partial class MainForm : Form |
|
|
|
|
if ( ch == 27 ) |
|
|
|
|
mSearchQuery.Text = "" ; |
|
|
|
|
else if ( ch >= 32 && ch < 127 ) { |
|
|
|
|
mSearchQuery.AppendText( e.KeyChar.ToString() ) ; |
|
|
|
|
mSearchQuery.Focus() ; |
|
|
|
|
SendKeys.Send( e.KeyChar.ToString() ) ; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|