txtDisplay.Text = "取消!";
}
else
{
txtDisplay.Text += "完毕, 开始调用WCF!";
//调用Service服务
ServiceClient proxy = new ServiceClient();
proxy.ShowMessageCompleted += OnShowMessageCompleted;
proxy.ShowMessageAsync(1, 100, sum);
}
}
void OnProgressChanged(object sender, ProgressChangedEventArgs e)
{
txtDisplay.Text = e.ProgressPercentage.ToString();
}
void OnDoWork(object sender, DoWorkEventArgs e)
{
//throw new ApplicationException("Foo");
while (cur_number <= 100 && !worker.CancellationPending)
{
Thread.Sleep(100);
sum += cur_number;
cur_number++;
worker.ReportProgress(sum);
}
if (worker.CancellationPending)
{
e.Cancel = true;
}
}
void OnShowMessageCompleted(object sender, ShowMessageCompletedEventArgs e)
{
if (e.Error != null)
&n