private void Freeze(object sender, RoutedEventArgs e) { Text.Text = "Start"; var longRunning = new HardLongOperations(); longRunning.RunPerformanceHeavy(); Text.Text = "Finished"; }
private async void NotFreeze(object sender, RoutedEventArgs e) { try { Text1.Text = "Start"; var longRunning = new HardLongOperations(); await longRunning.RunPerformanceHeavyInBackground(); //use to do nothing for some period of time. //note: having this awaited will let the thread to do another work while "doing nothing" await Task.Delay(100); Text1.Text = "Finished"; } catch { } }