void ButtonDown_Click(object sender, RoutedEventArgs e) { actionDemo = str => demoSource.StrInfo = str; ButtonDown.Content = "Downloading"; DownLoadDel downMethod = DoDownLoad; TextBoxInfo.Text = "Current Thread:" + Thread.CurrentThread.ManagedThreadId; downMethod.BeginInvoke(TextBoxURL.Text, CallBack, downMethod); }
private void CallBack(IAsyncResult asy) { if (asy == null) { throw new ArgumentNullException("asy"); } DownLoadDel del = asy.AsyncState as DownLoadDel; Trace.Assert(del != null, "Invalid object types"); del.EndInvoke(asy); }