提交 2ce0326f authored 作者: Mitch Capper's avatar Mitch Capper

Reset contact search bar string on escape or dial

上级 01a463e0
...@@ -229,7 +229,7 @@ namespace FSClient { ...@@ -229,7 +229,7 @@ namespace FSClient {
public void DialString(String str){ public void DialString(String str){
if (string.IsNullOrWhiteSpace(str)) if (string.IsNullOrWhiteSpace(str))
return; return;
MainWindowRemoveFocus(); MainWindowRemoveFocus(true);
if (str.StartsWith("#") && str.Length > 2) { if (str.StartsWith("#") && str.Length > 2) {
String acct_num = str.Substring(1, 1); String acct_num = str.Substring(1, 1);
...@@ -572,8 +572,8 @@ namespace FSClient { ...@@ -572,8 +572,8 @@ namespace FSClient {
public OurAutoCompleteBox GetContactSearchBox() { public OurAutoCompleteBox GetContactSearchBox() {
return MainWindow.get_instance().GetContactSearchBox(); return MainWindow.get_instance().GetContactSearchBox();
} }
public void MainWindowRemoveFocus(){ public void MainWindowRemoveFocus(bool ResetContactSearchText=false){
MainWindow.get_instance().RemoveFocus(); MainWindow.get_instance().RemoveFocus(ResetContactSearchText);
} }
private delegate void BroadcastEventDel(FSEvent evt); private delegate void BroadcastEventDel(FSEvent evt);
BroadcastEventDel BroadcastHandler; BroadcastEventDel BroadcastHandler;
......
...@@ -268,8 +268,10 @@ namespace FSClient { ...@@ -268,8 +268,10 @@ namespace FSClient {
} }
public void RemoveFocus(){ public void RemoveFocus(bool ResetContactSearchText=false){
btnMute.Focus(); //should really divert focus a better way btnMute.Focus(); //should really divert focus a better way
if (ResetContactSearchText)
ResetContactSearchStr();
} }
...@@ -424,10 +426,11 @@ namespace FSClient { ...@@ -424,10 +426,11 @@ namespace FSClient {
return txtSearchBox; return txtSearchBox;
} }
private const string contact_search_text = "Contact Search";
private void txtSearchBox_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { private void txtSearchBox_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) {
text_interception_enabled = false; text_interception_enabled = false;
txtSearchBox.Opacity = 1; txtSearchBox.Opacity = 1;
if (txtSearchBox.Text == "Contact Search") if (txtSearchBox.Text == contact_search_text)
txtSearchBox.Text = ""; txtSearchBox.Text = "";
} }
...@@ -436,7 +439,10 @@ namespace FSClient { ...@@ -436,7 +439,10 @@ namespace FSClient {
txtSearchBox.Opacity = 0.8; txtSearchBox.Opacity = 0.8;
if (String.IsNullOrWhiteSpace(txtSearchBox.Text)) if (String.IsNullOrWhiteSpace(txtSearchBox.Text))
txtSearchBox.Text = "Contact Search"; ResetContactSearchStr();
}
public void ResetContactSearchStr(){
txtSearchBox.Text = contact_search_text;
} }
private bool ContactMenuOpen; private bool ContactMenuOpen;
......
...@@ -150,7 +150,7 @@ namespace FSClient ...@@ -150,7 +150,7 @@ namespace FSClient
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
call_current_contact(); call_current_contact();
else if (e.Key == Key.Escape) else if (e.Key == Key.Escape)
Broker.get_instance().MainWindowRemoveFocus(); Broker.get_instance().MainWindowRemoveFocus(true);
} }
protected OurAutoCompleteBox search_box; protected OurAutoCompleteBox search_box;
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论