c# - Real-Time Text Processing -
i have program, translates text language. want improve small feature: text translates in real time when user types it.
i have written code:
private void textbox_keyup_1(object sender, system.windows.input.keyeventargs e) { translatebox.text = translate.translatetext(texttotranslate.text, "eng", "es"); }
it works, while type "hello world", function called 11 times. it's big load. is there way set timeout function?
ps. know how in js
, not in c#...
you can consider actual translation when found "word" finished, such after space/tab/enter key typed, or when textbox losts focus etc.
private void textbox_keyup_1(object sender, system.windows.input.keyeventargs e) { if(...) // here fill in condition translatebox.text = translate.translatetext(texttotranslate.text, "eng", "es"); }
Comments
Post a Comment