Silverlight C# - How to hold loop progress until an event completes? -


i'm trying loop through text in textbox word in order spellcheck it. i've split contents of textbox array, , loop through each word in array , run through spellchecker. when misspelling found, have popup listbox inside display can choose correction.

the issue i'm having, loops through whole array , ends showing last correction needs done.

how pause loop waits selection made , resume?

here's code loop:

  foreach(string checkedword in articlewords)         {             bool success = _spellchecker.checkword(checkedword);             list<string> suggest;              if (!success)             {                 suggest = _spellchecker.getsuggestions(checkedword);                 spellchecklistbox.items.clear();                  foreach (string s in suggest)                 {                     spellchecklistbox.items.add(new listboxitem() { content = s });                  }                 spellcheckerpopup.isopen = true;                 spellchecklistbox.items.add(new listboxitem() { content = "          ----------------------" });                 spellchecklistbox.items.add(new listboxitem() { content = "ignore" });             }           } 

when spellcheckerpopup displays, have event trigger in listbox on selectionchange.

basically, need pause loop somehow, , when selectionchange event it's thing, have loop resume.

thanks in advance!

-sootah

if i'm not misunderstanding, going to:

(1) check each word in loop

(2) pause loop when error found , pop suggestion window

(3) user select suggestion word , resume loop

i think it's better , easier if solution is:

(1) check word first one

(2) quit check method error flag, , store position in variable, pop suggestion window

(3) user selects suggestion word , when user has confirmed suggestion(e.g. pressing ok on suggestion window), start checkwordmethod again stored position

(4) until step (2) quits no error flag, means words correct (but make sure in whole progress, users can modify words suggestion window)


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -