protected async void Button1_ClickAsync(object sender, EventArgs e) { Servicetest.Service1Client client = new Servicetest.Service1Client(); string S = client.GetData(5); string vv = S; client.GetBookCompleted += new EventHandler <Servicetest.GetBookCompletedEventArgs>(Klient_avsluta); //var v = client.GetAllBooks(); using (new OperationContextScope(client.InnerChannel)) { var task = client.GetAllBooks(); var b = task; } }
public async Task LoadSomeData() { Servicetest.Service1Client client = new Servicetest.Service1Client(); //string V = await client.HelloAsync("Ian"); //await Task.WhenAll(V); //Task<string> task = client.HelloAsync("Ian"); /*var task = client.GetBookAsync(); * if (task == await Task.WhenAny(task, Task.Delay(1000))) * { * Console.WriteLine(await task); * var V = task.Result; * } * else Console.WriteLine("Timed out"); * //var VV = V;*/ }