|
-
Aug 23rd, 2013, 07:14 PM
#1
Re: Help getting started with DataRepeater
Woah... what's with the background worker that just do adds and deletes? What the heck? There isn't a reason for that. Especially since the only thing they do is then interact with the DR on the primary thread. It's like going out the front door, getting into your car, backing up, using the garage remote to open it up, plulling back in, going into the garage, get a hammer, back into the car, close garage door, then go back through your front door. You're creating a thread that then has to go back to the primary thread and update the UI.... why? Just update the UI in the first place... no need for the thread or the invoke.
-tg
-
Aug 24th, 2013, 09:57 AM
#2
Thread Starter
Hyperactive Member
Re: Help getting started with DataRepeater
Ah yes in this particular test case. However, I wanted to test how it would work if I was using multiple threads that also perform other work with access to the list as only part of that for some reason (as I actually am doing in my own application) then the list actions are effectively bound to the UI thread and so seem to require invocation - though if you have other ways of doing the same do let me know.
Sure if my threads aren't doing anything else then they are not needed and the actions can be done as one would normally expect
Wow, thanks for putting the time in with the dictionary!! I'll have a play around with your code now - With the copying to list idea, wouldn't that need to be done every time I made any change to the dictionary?
A little more background on my application and why I've threaded the list actions: The list item objects represent real devices that require a set of instructions to be run on them at certain times. EG. itemN device starts, some setting is sent to it over TCP and then runs for 2 hours then the setting changes and it runs for another 1.5 hours and so on. There may be many items running these processes at the same time.
The settings and times are stored in a database.
Rather than have a thread dedicated to each item, that could be doing nothing but timing for the majority of its lifetime of around 10 hours or so, I decided to have one thread handle all the timing (like a kind of scheduler) and then just run extra threads for only when they are required.
I call these setting/time pairs "program steps". Each item then needs to be added to the list when it is created, needs to have which step it is on (along with several other things) set and got by the threads handling DB and TCP whenever these extra work threads are created.
Then the final step is when the item is finished and so needs to be removed from the list. This is also run just like any other step, on a thread .
So yes, massive overkill for simple single-threaded CRUD list operations. But essential for any multiple-threaded application - whats more, it's not easily found out by those who dont already know what they're doing. I only started the thread here after I'd got quite frustrated trying to find VB information specific to binding lists rather than the most basic datatable binding.
Thanks 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|