Add the reference
using System.ComponentModel;
Then the code looks like:
namespace AsynchronousNonBlocking
{
public partial class Window1 : Window
{
ServiceReference1.Service1Client test2;
public Window1()
{
InitializeComponent();
test2 = new ServiceReference1.Service1Client();
}
private void btnSynchronous_Click(object sender, RoutedEventArgs e)
{
ServiceReference1.Service1Client test = new ServiceReference1.Service1Client();
test.DoWork();
}
private void btnAsynchronous_Click(object sender, RoutedEventArgs e)
{
test2.DoWorkCompleted += new EventHandler
test2.DoWorkAsync();
}
public event System.EventHandler
static void DoWorkCallback(object sender, AsyncCompletedEventArgs e)
{
Console.WriteLine("Done");
}
}
}