August 24th, 2010, 06:13 PM
Scheduler design questions - need input
I have a weekly schedule that has the control structure as shown by this captured picture link.
The rectangles are Control Borders located inside a Grid. My grid is 1 row, 2 columns. The time lines within the border are done by drawing lines using the Line method. This is the only way I could figure out how to place the lines at absolute pixel locations. When the user presses the Update Schedule button, I fill in each 15 minute block with Red (for ON) or White (for OFF) depending on the user schedule selection. I use the Line method once again to 'fill in' each 15 block. I tried to use the rectangle method, but it didn't have a way to draw at a particular coordinate within the grid. Does anyone have a better method to use?
Also, how do you release Line objects? I've noticed that with each Update Schedule press, the update time takes longer and longer. I think because the resources are never released and are taking up stack space. With each 15 minute block, I create 6 Lines and I think those 6 Lines stay as objects as long as the window is active. So, how do I resolve this? Do I need to create 4032 Line objects (7 days * 96 intervals * 6 per interval) and just update them as I need to? It seems as though there is a better way. But, I need absolute coordinate control. It would probably be better to draw a rectangle and fill it in, but again I can't seem to get coordinate control.
August 25th, 2010, 09:44 AM
Re: Scheduler design questions - need input
I've done something similar for an employee scheduling system.
The attached view consists of several layered controls.
There is a timegrid control that displays the time values at the top (e.g. 7am to 10pm) and the vertical lines with major and minor divisions. This control takes an array of child controls. Each child control displays a single time text and the major line and minor line. The minor line is hidden for the last time entry along the right side.
Sitting above the timegrid control is the dayofweek control. This control is a listbox that represents days of the week (Monday, Tuesday, etc).
Each day of week control, takes an array of shift controls which represent the shifts within the day.
All the controls autoresize themselves and maintain the correct proportion of the shift bars within the time lines as the user resizes the application.
Click Here to Expand Forum to Full Width