Re: timer/threading
- From: Marc Gravell <marc.gravell@xxxxxxxxx>
- Date: Wed, 13 Feb 2008 12:58:08 -0800 (PST)
OK; the timer (via SyncContext) fires on the UI thread. You then start
a thread, which immediately does a BeginInvoke back to the UI
thread...
At the moment you background thread is doing nothing useful; try to
split it so that it does something like:
private void liveprices()
{ // expecting this on a non-UI thread!
//TODO: go get the data into a new DataTable, array or
whatever
BeginInvoke((MethodInvoker) delegate {
//TODO: update the grid
});
}
Now the "fetch" happends on the worker thread, and the UI update
happens on the UI thread.
However, every second seems optimistic for DataTable; I'm hoping
you're using a "get changes since <x>" mechanism in the database?
And note that if your datatable is UI bound you can only touch it from
the UI thread.
Marc
.
- Follow-Ups:
- Re: timer/threading
- From: RobcPettit@xxxxxxxxxxx
- Re: timer/threading
- References:
- timer/threading
- From: RobcPettit@xxxxxxxxxxx
- timer/threading
- Prev by Date: Re: Finding the object instance from the attribute instance
- Next by Date: Re: C# database project
- Previous by thread: timer/threading
- Next by thread: Re: timer/threading
- Index(es):
Relevant Pages
|
Loading