Emlid.WindowsIot.Hardware.Boards.Navio.NavioRCInputDevice.Dispose C# (CSharp) Method

Dispose() protected method

Frees resources owned by this instance.
protected Dispose ( bool disposing ) : void
disposing bool /// True when called via , false when called from the finalizer. ///
return void
        protected override void Dispose(bool disposing)
        {
            // Only managed resources to dispose
            if (!disposing)
                return;

            // Un-hook events
            _inputPin.ValueChanged -= OnInputPinValueChanged;

            // Stop background tasks
            _stop?.Cancel();

            // Stop events
            _valueTrigger?.Dispose();
            _frameTrigger?.Dispose();

            //  Close device
            _inputPin?.Dispose();
        }