Tuesday 17 August 2010

Modifying the C# CollectionEditor for real-time updates

In one of my projects I'm using a PropertyGrid element in the main form as an easy way for users to change settings. One item in the class used by the PropertyGrid is a collection and C# automatically opens a CollectionEditor form for the user to add, remove and modify elements of the collection.

The issue however is that changes to the collection should be represented in the main area of the form immediately, but the CollectionEditor control seems to leave the collection in an undefined state until the form is closed.

I can understand what the CollectionEditor form is trying to do, it is waiting until the user clicks on OK or Cancel before writing the changes to the actual collection. However it doesn't do this, it partly mucks up the collection when the user changes items or adds them, but doesn't touch the actual collection when the user removes or rearranges items.

Monday 16 August 2010

Torque and Power

When discussing performance or simulations of vehicles, the concepts of torque and power usually come up and often get confused. Our goal in writing a simulation is to get the vehicle to behave exactly like the real vehicle, in order to do this it is vital to understand the concepts of torque and power from the engine (these concepts apply to all type of rotary engines, including electric motors).