c# - Windows phone 8.1 RT Modify control in another thread -


i have async function. in function modify control in page. detail this

`async public void methodname(){ await ... dosomething; control.visibility = visibity.visible;}` 

and use

 task.run(delegate()  {      getdata();  }); 

to run function in thread (i want function run implicit). have exception this. control can't modify in thread. know should ?

to update ui components separate thread, use so:

await dispatcher.runasync(coredispatcherpriority.normal, () => {     //update ui here }); 

an example can found here around line 113. code there called event of accelerometer, , separate thread. therefore code update text boxes in event wrapped in lines posted above.
hope solve problem :)


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -