Re: Treeview events
- From: timor.super@xxxxxxxxx
- Date: Sun, 28 Sep 2008 00:10:24 -0700 (PDT)
I find your method quite hard.
It's strange that I need to watch the entire system to be aware of
files modification on a tree.
I won't load the entire tree at beginning too, it's taking too much
time ...
Is there a design pattern for treeview ?
On 27 sep, 23:08, "Peter Duniho" <NpOeStPe...@xxxxxxxxxxxxxxxx> wrote:
On Sat, 27 Sep 2008 13:58:20 -0700, <timor.su...@xxxxxxxxx> wrote:
Thanks for your answer. The "thing" is :
it's a treeview containing the files on the hard drive, so, deploy a
node load the files under the directory
Selecting the node, update the node with possible change on the hard
disk, clicking on the node too ...
When there's many files, the loading or updating (that is the same
task) can be quite long, that's why I would like to avoid loading this
too many times.
Any idea ?
Yes. Don't do that. :)
Instead, your nodes should retrieve the data as needed according to
visibility and changes to the directory. You can use FileSystemWatcher as
a way to monitor the latter; it's not perfect (rapid changes can overwhelm
it, especially if you're not careful to keep your event handlers simple),
but it'd be automatic rather than relying on user input and would avoid
the redundancy
If you insist on relying on user input to decide when to refresh, don't
make it based on selection. Retrieve the data as needed according to
visibility, and then provide the user with an explicit option to refresh
the data (e.g. context menu).
One final option, if you insist on this redundant behavior, is to handle
the updating in a worker thread and only start it again if you're not
already processing that node. Of course, each node would have to keep
track of whether it's waiting for such a worker thread to finish updating
it, but that's not hard.
Pete
.
- Follow-Ups:
- Re: Treeview events
- From: Peter Duniho
- Re: Treeview events
- References:
- [Winforms] Treeview events
- From: timor . super
- Re: [Winforms] Treeview events
- From: Peter Duniho
- Re: Treeview events
- From: timor . super
- Re: Treeview events
- From: Peter Duniho
- [Winforms] Treeview events
- Prev by Date: Re: creating a _simple_ fine grained user based security system
- Next by Date: Re: Is there any better way than obfuscation?
- Previous by thread: Re: Treeview events
- Next by thread: Re: Treeview events
- Index(es):
Relevant Pages
|