using System;
public class ImageConverter
{
public void button1_Click(Object sender, RoutedEventArgs e)
{
string filename=null;
SendImageToPlayer send = new SendImageToPlayer();
//send.ReadImageFile(filename);
Thread t = new Thread(new send.ReadImageFile);
uint ret=send.ErrorCode;
}
}
public class SendImageToPlayer
{
...
public void ReadImageFile(string PfileName)
{
//something
}
...
}
The code above shown will not work. I want to run ReadImageFie in separate thread. How can I do that?
Introduce a property
FileNameon your SendImageToPlayer class and set it before you start the thread.Consider using the BackgroundWorker thread class. It provides events when the thread completes.
You check the ErrorCode when the RunWorkerCompleted event is fired.