I am trying to do a long process with multi threads. How can I get resutn value from threads? If I can get return values, I will update database according to the return value.
here is my code that calls the threads...
foreach (var obj in elements) {
string body_ = @"<html><head></head><body><a href='http://localhost:5111/Default.aspx?id=" + obj.ID + @"&answer=yes'>Evet</a> - <a href='http://localhost:5111/Default.aspx?id=" + obj.ID + @"&answer=no'>Hayır</a></body></html>";
Thread thread = new Thread(() => sendEmailThread(obj.ALICI, obj.KONU, body_));
thread.Start();
}
here is the thread invoker.....
private void sendEmailThread(string ALICI, string KONU, string body_)
{
this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)delegate() { sendEmail(ALICI, KONU, body_); } );
}
here is the real email sender
public int sendEmail(string to_,string subject_,string body_) {
.......
.......
.......
return 1;
}