我想要一个线程,轮询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(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");}
}
我的问题是线程无法工作......它显示活着,但它什么也没做...... 当我直接调用它它的工作原理,但我想把它作为一个线程。 我期待着回答