Using the Arduino to control the solenoid valve is simply a case of setting a pin high for the appropriate amount of time. There is, however, a caveat, the solenoid works at a different voltage to the Arduino and you cannot directly connect the two. In this case a TIP120 transistor is used as a bridge.
The TIP120 allows a small dc voltage (from the Arduino) to switch a larger dc voltage (12V to the solenoid). It can be thought of as a switch, applying a current to B allows current to flow between C to E.
Connecting a solenoid to an Arduino
The diode (a 1N4007 in this case) connected to the solenoid allows current to flow only in one direction. When the current is turned off the solenoid tries to continue the current. This can fry the Arduino. The diode feeds this current back in to the solenoid until it is dissipated.
You can get more information about connecting a solenoid at