[問題] thread再問
google 參考
http://www.switchonthecode.com/tutorials/working-with-the-wpf-dispatcher
還是一樣卡死阿.....
private void button1_Click(object sender, RoutedEventArgs e)
{
Thread t1 = new Thread(comet_hook);
t1.Start();
}
public void comet_hook()
{
while (true)
{
System.Threading.Thread thread =
new System.Threading.Thread(
new System.Threading.ThreadStart(
delegate()
{
richTextBox1.Dispatcher.Invoke(
System.Windows.Threading.DispatcherPriority.Normal,
new Action(
delegate()
{
richTextBox1.AppendText("aaa");
}
)
);
}
));
thread.Start();
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.254.13.14
→
05/31 15:51, , 1F
05/31 15:51, 1F
這只是SAMPLE 實際上richTextBox1.AppendText("aaa"); 的地方
會是一個無限次自動重複掛載的HTTP物件動作
無限次的repeat 想來想去似乎只有while(true){...}好處理
※ 編輯: erspicu 來自: 111.254.13.14 (05/31 15:58)
※ 編輯: erspicu 來自: 111.254.13.14 (05/31 16:22)
→
05/31 16:29, , 2F
05/31 16:29, 2F
→
05/31 16:32, , 3F
05/31 16:32, 3F
那先不談 我要寫的程式好了 為何這個程式結果一直跑不出來呢?
※ 編輯: erspicu 來自: 111.254.13.14 (05/31 16:33)
討論串 (同標題文章)
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章