C# silverlight、xaml、线程问题
我想要一个线程,用于轮询Web服务。 但是线程不工作 xxx.xaml.cs:C# silverlight、xaml、线程问题,c#,silverlight,xaml,multithreading,C#,Silverlight,Xaml,Multithreading,我想要一个线程,用于轮询Web服务。 但是线程不工作 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(1
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");}
}
我的问题是线程不工作。。。它活着,但它什么也没做。。。
当我直接调用它时,它可以工作,但我希望它作为一个线程。
我期待着得到答案试着找一个幕后工作者 您将找到如何实现这一点的文档