Developer technologies | Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows devices.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
In the following code snippet, How to update multiple labels? for example: Have several parameters in the update method instead of one parameter
private void UIupdate(str
ing name)
{
var timenow = DateTime.Now;
if((DateTime.Now-dt).Milliseconds<=50)
return;
synchronizationcontext.Post(new SendOrPostCallback(o =>
{
lblFirstName.Text = "name" + (string)o;
//lblLastName.Text = ?
//lblZipCode.Text=?
}),name );
dt = timenow;
}
A Microsoft platform for building and publishing apps for Windows devices.
Answer accepted by question author
To update multiple labels you could do this.
private void UIupdate(string name, string lastName, string zipCode)
{
synchronizationcontext.Post(new SendOrPostCallback(o =>
{
(string name, string last, string zipCode) state = ((string, string, string)) o;
lblFirstName.Text = $"name {state.name}";
lblLast.Text = $"last {state.last}";
lblZipCode.Text = $"zip code {state.zipCode}";
}), (name, lastName, zipCode));
}