This is another simple example but it demonstrates a concept that we frequently use that we did not see in Jeff's book. We like to display the status of equipment on screen. In this example, the pump is gray when off, green when on and red during a fault condition. It was very quick and easy to use Symbol Factory to generate three different colored pumps. We exported the pumps from Symbol Factory into Windows metafiles, loaded them into Microsoft PhotoDraw and exported as jpeg images. The trick is to load one of the three pictures as the state changes.
In this example we use one image control and loaded the pump image when the button was clicked. Another method is to have three overlapping image controls and you load a picture into each image control when the page is first loaded (program is first started). Then you simply change the visible properties of each image control between true and false depending on if you want the particular image to be shown on the screen. The first approach is slower but only needs one image control. The second approach is faster (it does not have to keep loading image files from the disk -- the image is already in memory) but uses more memory. Usually we prefer the second approach (multiple images in memory).
Note that in a real application you would not click a button to change the status of the pump. You would have an "UpdatePage" function that was called about once a second that reads the status of all the devices and displays the color of each device.
The best approach would be to make a "pump control". This would be one custom control where you would simply select the status of the pump. Click for an example of custom controls. Unfortunately, the source code for these custom controls is only available to our customers.
To run the ASP.NET application on-line click here.
We try to offer a fair and balanced opinion on every page of our website. We would appreciate more information from other users to express their opinions which we will then incorporate. If you have questions or comments please post them on our message board (see button in left hand column) so that others can read and benefit.