Closed q55x8x closed 9 years ago
If it's easier you can just select the first node matching the search and have a button got "next" and "prev" occurrence. Of course you also have to open all the parent nodes to make that node visible if it is not
That would probably be much more efficient and probably more usable than hiding the nodes
I have redone the search a bit simpler in 149409d210b4b6223bb335b18cdd646e1ae8ec98 but still even with O(N) we are a bit unresponsive :/
UI is now responsive during search see: 270d31465508504504f245b1968455b31a869ddc The layout actually took the most time to execute so I suspended it while searching and adding things to the tree.
You probably need to do the tree search in a separate thread (you can probably parallelize it too) and update the UI only when you are done to avoid UI freezes
The search should be that long as the tree isn't that large and we are only looking for the node names but that should help
The way I would do it :
On trigger search :
If the tree change while a search is active :
I tried multiple approaches on multithreading but I haven't learned a lot about it specifically until now and so I don't have that much experience in context synchronizations.
The new c# task class makes synchronizing with the UI context a lot easier but only allows aborting tasks with cancellation tokens but I never had to use them.
Using the old way (Threads) produces a lot of overhead you have to write to synchronize properly. I tried that yesterday but haven't found a way to abort the search thread without causing the UI context to mess up completely and crash.
I will try a bit more regarding this topic and at least add an indicator that a search is currently taking place until filtering has finished but I can't promise that I will be able to make the search in a separate thread very soon. But I don't think that the search is currently the most important thing as I got it to work with at least very little unresponsiveness (see: 270d31465508504504f245b1968455b31a869ddc)
I think with 96476c4ac418bb5d6c518c67d7581cab8a609f7a this can now be closed
Haven't looked that much inside of why it doesn't filter anything or how we could improve it with e.g. incrementally removing treeNodes from the tree as the user types. But I will try some more things tomorrow.