Exemplo n.º 1
0
        private void Freeze(object sender, RoutedEventArgs e)
        {
            Text.Text = "Start";
            var longRunning = new HardLongOperations();

            longRunning.RunPerformanceHeavy();
            Text.Text = "Finished";
        }
Exemplo n.º 2
0
        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
            {
            }
        }