I have a treeview and it's used for managing the folders/programs in a systray program launcher I made. I wanted to add a way to move multiple programs to other parent folders easily. I figured no big deal, I'll make the TreeView allow multiple selection, that's not an issue right? Welllll apparently it is. So I figured OK, I'll build a little popup window that asks you to select the parent for the items then have a listbox that shows all the available nodes and you select what you want. Easy peasy.
However... I can't figure out the right way to build my listbox items. Say I have a treeview with these nodes:
- Apps
- |__FileZilla
- |__Outlook
- Media
- |__Photoshop
- |__Audacity
- |__Video
- |__ZoomPlayer
- |__VLC
I want my resultant listbox to have:
- Apps\FileZilla
- Apps\Outlook
- Media\Photoshop
- Media\Audacity
- Media\Video\ZoomPlayer
- Media\Video\VLC
I see the TreeNodes have a Parent property so I figured I'd make a method I can call that calls itself and builds the list. To make a long story short; it was a hot mess, lol. Did not work well. I just can't wrap my head around the correct process/flow.
Each TreeNode's Tag is a wrapper "Node" which has a property to determine if it's a folder or a program. I figure I can check that as I iterate the nodes and check if ((Node)treeNode.Tag).NodeClass == NodeClasses.Folder then I know I don't have to add it to the listbox.
Can someone assist? Thanks!
PS on a tangent here, but out of curiosity... that NodeClasses enum, my Java teacher said enum properties should be UPPERCASE. I see in most code examples in C# they are PascalCase. Is that the accepted standard for C#? I really don't like all caps so I avoided it. Just curious if that's against naming conventions or not.