CSHttpClientSample.Program.working C# (CSharp) Method

working() public method

public working ( ) : void
return void
        public async void working()
        {
            while (true)
            {


                EventStreamResponse response = await client.OnAsync("screenshot", (sender, args) =>
                {
                    System.Console.WriteLine(args.Data);

                    if (check.ToLower() != args.Data.ToLower())
                    {
                        Task taskA = Task.Factory.StartNew(() => MakeRequest(0, "https://foreveralone.blob.core.windows.net/picture/myblog.jpg"));
                        taskA.Wait();
                        Console.WriteLine("taskA has completed.");
                        int time = 1000;
                        Thread.Sleep(time);

                        Task taskB = Task.Factory.StartNew(() => MakeRequest(1, "https://scontent-lax3-1.xx.fbcdn.net/hphotos-xpf1/t31.0-8/882115_161761973982107_1639044371_o.jpg"));
                        taskB.Wait();
                        Console.WriteLine("taskB has completed.");

                        Thread.Sleep(time);

                        if (taskB.IsCompleted && taskA.IsCompleted)
                            MakeRequest2();
                        else
                            Console.WriteLine("Timed out.");

                        check = args.Data;
                    }

                });
            }
        }