I want my application updates the screen information while the code is executing. I tried with this.LayoutRoot.UpdateLayout(); but it didn’t work and I don’t understand why. Can anyone help me?
The application receive a button propriety from a button clicked, then use that to a several things in a Model class, and then I want it show a message to the user. after that i want it continue executing more things (AI)… :S
public void showMsgFromModel(string player, string msg)
{
if(player!="")
txNomeMsg.Text = player + ":";
else
txNomeMsg.Text = player;
txMsg.Text = msg;
this.LayoutRoot.UpdateLayout();
System.Threading.Thread.Sleep(1500);
}
You’re trying to do some processing from the UI thread, which is therefore unable to update the interface.
Use a background worker to execute long-running tasks, and use the dispatcher when you need to update the UI: