I want to have a thread, that polls the webservice. Howerver the thread doesnt work ...
xxx.xaml.cs:
public class Alpha:Page
{
// This method that will be called when the thread is started
public void polling()
{
while (true)
{
Thread.Sleep(1000);
//MessageBox.Show("polling");
Gamedetails_Player2.show();
}
}
};
class ...:Page
public Gamedetails_Player2()
{
// Required to initialize variables
InitializeComponent();
Alpha oAlpha = new Alpha();
Thread poll = new Thread(oAlpha.polling);
poll.Start();
MessageBox.Show("polling started"+poll.IsAlive);
//oAlpha.polling();
//polling();
}
public static void show(){MessageBox.Show("running");}
}
My Problem is that the Thread is not working ... it shows alive but it makes nothing... when i call it directly it works but i want to have it in as a thread. Im looking forward for answeres
尝试使用BackgroundWorker 在这里您将找到如何实现此目的的文档。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.