Results 1 to 8 of 8

Thread: Optimizing custom control question.

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Optimizing custom control question.

    Ok so I have a custom tree view control. It has a list of 'group' names for grouping the _datasource in root/child/.../child relationships.
    In a thread, it is looking for changes to the database and updating the _datasource and re-rendering the tree view every so often (8 seconds).

    There's also a whole other host of things it does on initial drawing and re-drawing. I have to remember which nodes were expanded/collapsed.
    I also have checkboxes out to the far right of each node for particular use and they can be enabled/disabled for each level.
    Also, the text of the node changes on each level depending on certain criteria.

    It's fine with small sub sets of records. But once you get into the 100's it starts to get slow on refresh. The slowness is due to a
    combination of volume of changes to the database and volume of records in the resulting _datasource.

    I'm ordering the _datasource by the 'group' names in the control's 'group' list, in order (0,1,2). Then I loop through the _datasource and build the entire tree.
    After I build the entire tree I go through and expand/collapse, color, check as needed and then actually add the items to a panel.

    I'm just not sure how I could speed this up. Because once I've drawing these nodes to the panel in treeview (.Location and etc), I don't think I can
    simply move down the other controls if I needed to insert (a root node with children for example) a new root node into the middle of the list.

    I could just tack them onto the end, but the tree structure is like so:

    - Date
    --- Docket and Name
    ----- Document Name 1
    ----- ...
    ----- Document Name N

    And unfortunately, they need to be ordered by date.

    So, any advice or tips would be much appreciated.

    Thanks a lot,

    Justin
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Optimizing custom control question.

    it is looking for changes to the database
    Explain this in detail, please. It worries me!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3
    Member
    Join Date
    Nov 2013
    Posts
    50

    Re: Optimizing custom control question.

    Is there any way you can limit the activity to what is being shown in the control? IOW, only do updates/refreshes for what the user can see and is working with.

    Paul
    Please mark your threads Resolved if your thread has been answered..And don't forget to rate the post if the answer has helped you.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: Optimizing custom control question.

    The control is used in a queuing system for a court. So if queue A sends queue B a document, the number of records for queue B in the database will change. So it will update the interface.
    Likewise, the queue will change for the document, so it will update queue A's interface to say '[Queue B]' (queue B's interface will say '[From Queue A]').

    It's looking for changes = querying.
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: Optimizing custom control question.

    I think what I need to do is figure out a way to insert/append to the visual customtreeview through delegate subroutines so I don't inhibit the user's experience so much. And maybe make it a Client/Server app so it's not constantly querying the database every 8 seconds (even though it's in a background working thread) and doing these things in response to server triggers.

    The querying may not be the best (may be the worst) practice, but I don't think it's actually affecting the user's experience until a refresh is in order.
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  6. #6
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Optimizing custom control question.

    The querying may not be the best (may be the worst) practice, but I don't think it's actually affecting the user's experience until a refresh is in order.
    Er ... seriously? The control should not be querying a database at all ... not ever! Binding to a datatable (in memory), fine! Querying a database, absolutely not, and that goes doubly for repeated queries, and triply for queries being fired off every 8 seconds. All database actitivites should happen in the body of your program in the normal way. The control should only have access to the results of that activity not be involved in it in any way!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: Optimizing custom control question.

    Oh yeah, I'm sorry. The control is being fed the results of the query in the form of customtreeviewnodes. The querying and creation/adding of the nodes is being done in the QueueView Form parent of the CustomTreeView.
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: Optimizing custom control question.

    But instead of just calling CustomTreeView.RefreshNodes(), I'm going to try and only call that the first load and make my adds/inserts move around the UI elements as well to avoid having to draw ALL the nodes from the root every time it refreshes.
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width