I programming a c# code, I just used a thread to display a data on the UI, once per 100 ms. But I found the CPU(not the memory) is very high, from 20% to 70% immediately. Could someone else help me for this problem?
public delegate void ThreadDisplayDelegate(string message);
public ThreadDisplayDelegate _threaddelegate;
public void DisplayCurrentDialog(string message)
{
if (_UI_receive.Dispatcher.CheckAccess())
{
_UI_receive.Text = message;
}
else
{
_UI_receive.Dispatcher.Invoke(_threaddelegate, message);
}
}
public void ThreadUIDisplay()
{
_threaddelegate = new ThreadDisplayDelegate(DisplayCurrentDialog);
while (_continue)
{
DisplayCurrentDialog(_m_received_message);
System.Threading.Thread.Sleep(100);
}
}