The CPR variable is set outside of the event handler, and only updated when the value is changed by the user.
You can find the code sample on the page you linked if you scroll past the code sample generator to the table below. It's the visual studio C# GUI example for the encoder object.