Ejemplo n.º 1
0
        private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            await TestAsync.DoSomethingAsync();

            BeginAnimation();

            CompositionTarget.Rendering += CompositionTarget_Rendering;
            CompositionTarget.Rendering += CompositionTarget_Rendering1;
        }
Ejemplo n.º 2
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            string tag = (e.OriginalSource as Button).Tag.ToString();

            switch (tag)
            {
            case "0x0001":
                await TestAsync.DoSomethingAsync1();

                break;

            case "0x0002":
                ststxt.Text = await TestAsync.DelayResult("0x0002", TimeSpan.FromSeconds(2));

                break;

            case "0x0003":
                ststxt.Text = await TestAsync.DownloadStringWithRetries("https://localhost:44312/api/values");

                break;

            case "0x0004":
                ststxt.Text = await TestAsync.DowloadStringWithTimeout("https://localhost:44312/api/values/20");

                break;

            case "0x0005":
                var progress = new Progress <int>();
                progress.ProgressChanged += (sender, args) =>
                {
                    ststxt.Text = args.ToString();
                };
                await TestAsync.ProgressAsync(progress);

                break;

            case "0x0006":
                ststxt.Text = await TestAsync.DowloadAllAsync(
                    new string[] {
                    "https://localhost:44312/api/values/20",
                    "https://localhost:44312/api/math/sin/0.52358",
                    "https://localhost:44312/api/math/cos/num=1.04716",
                }
                    );

                break;

            default:
                break;
            }
        }