I have a dialog with some txb\'s and a button. When this button is clicked I want to change the button\'s Text, disable the button, start some Logic and then close the Window.>
private async void ButtonClick()
{
//here, you're on the UI Thread
button1.Enabled = false;
await Task.Run(() => DoTheWork());
//you're back on the UI Thread
button1.Enabled = true;
}
private void DoTheWork()
{
//this will be executed on a different Thread
}