Table of Contents

Class ButtonBase

Namespace
Iot.Device.Button
Assembly
Iot.Device.Button.dll

Base implementation of Button logic. Hardware independent. Inherit for specific hardware handling.

public class ButtonBase
Inheritance
ButtonBase
Derived

Constructors

ButtonBase()

Initializes a new instance of the ButtonBase class.

public ButtonBase()

ButtonBase(TimeSpan, TimeSpan, TimeSpan)

Initializes a new instance of the ButtonBase class.

public ButtonBase(TimeSpan doublePress, TimeSpan holding, TimeSpan debounceTime = default)

Parameters

doublePress TimeSpan

Max ticks between button presses to count as doublepress.

holding TimeSpan

Min ms a button is pressed to count as holding.

debounceTime TimeSpan

The amount of time during which the transitions are ignored, or zero.

Properties

IsDoublePressEnabled

Gets or sets a value indicating whether double press event is enabled or disabled on the button.

public bool IsDoublePressEnabled { get; set; }

Property Value

bool

IsHoldingEnabled

Gets or sets a value indicating whether holding event is enabled or disabled on the button.

public bool IsHoldingEnabled { get; set; }

Property Value

bool

IsPressed

Gets or sets a value indicating whether single press event is enabled or disabled on the button.

public bool IsPressed { get; set; }

Property Value

bool

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

Cleanup resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Should dispose managed resources.

HandleButtonPressed()

Handler for pressing the button.

protected void HandleButtonPressed()

HandleButtonReleased()

Handler for releasing the button.

protected void HandleButtonReleased()

Events

ButtonDown

Delegate for button down event.

public event ButtonBase.ButtonPressedDelegate ButtonDown

Event Type

ButtonBase.ButtonPressedDelegate

ButtonUp

Delegate for button up event.

public event ButtonBase.ButtonPressedDelegate ButtonUp

Event Type

ButtonBase.ButtonPressedDelegate

DoublePress

Delegate for button double pressed event.

public event ButtonBase.ButtonPressedDelegate DoublePress

Event Type

ButtonBase.ButtonPressedDelegate

Holding

Delegate for button holding event.

public event ButtonBase.ButtonHoldingDelegate Holding

Event Type

ButtonBase.ButtonHoldingDelegate

Press

Delegate for button pressed event.

public event ButtonBase.ButtonPressedDelegate Press

Event Type

ButtonBase.ButtonPressedDelegate