Register for the ValueChanged event

Please let me know if anyone on this forum can spare some C# code for monitoring inputs using event instead of timers? FezHat and FezUtility drivers and sample code all use a timer to check when an input has been fired.

timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMilliseconds(500);
timer.Tick += Timer_Tick;

I will like to use events the same way as used on Windows IOT Core and I have not idea how to do that. A sample to get me started will be nice.

        private GpioPin buttonPin;
            buttonPin = gpio.OpenPin(BUTTON_PIN);

            // Check if input pull-up resistors are supported
            if (buttonPin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))

            // Set a debounce timeout to filter out switch bounce noise from a button press
            buttonPin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged
            // function is called when the button is pressed
            buttonPin.ValueChanged += buttonPin_ValueChanged;

That would be a cool thing to have! :clap:
Suggest you add this as a feature request to the .NETMF repo @ [url][/url].


leforban, sorry for the question but how is the link you provided related to the FezHat and the FezUtility boards?