Class Bike
The primary class for the under desk bike.
Implements
Inherited Members
Namespace: UnderDeskBike
Assembly: UnderDeskBike.Device.dll
Syntax
public class Bike : NotifyObject, IDisposable
Constructors
Bike(TextWriter)
Initializes a new instance of the Bike class.
public Bike(TextWriter logger = null)
Parameters
Type | Name | Description |
---|---|---|
TextWriter | logger | The logger. |
Properties
IsConnected
Gets a value indicating whether this instance is connected.
public bool IsConnected { get; }
Property Type
Boolean |
IsWorkoutRunning
Gets a value indicating whether this instance is workout active.
public bool IsWorkoutRunning { get; }
Property Type
Boolean |
WorkoutData
Gets the distance in miles.
public BikeWorkoutData WorkoutData { get; }
Property Type
BikeWorkoutData |
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(Boolean)
Releases unmanaged and - optionally - managed resources.
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing |
|
StartListening()
Start listening for a connection.
public Task StartListening()
Returns
Type | Description |
---|---|
Task | A |
StartWorkout(Int32)
Starts the workout.
public Task<bool> StartWorkout(int interval = 250)
Parameters
Type | Name | Description |
---|---|---|
Int32 | interval | The interval. |
Returns
Type | Description |
---|---|
Task<Boolean> | A |
StopListening()
Stops the listening.
public Task StopListening()
Returns
Type | Description |
---|---|
Task | A |
StopWorkout()
Stops the workout.
public Task StopWorkout()
Returns
Type | Description |
---|---|
Task | A |
WaitForConnection()
Waits for connection.
public Task WaitForConnection()
Returns
Type | Description |
---|---|
Task | A |
WaitForWorkout()
Waits for workout end.
public Task WaitForWorkout()
Returns
Type | Description |
---|---|
Task | A |
Events
Connected
Occurs when connected.
public event EventHandler Connected
Event Type
EventHandler |
Disconnected
Occurs when disconnected.
public event EventHandler Disconnected
Event Type
EventHandler |
Error
Occurs when a background error is triggered
public event EventHandler<ExceptionEventArgs> Error
Event Type
EventHandler<ExceptionEventArgs> |
WorkoutEnded
Occurs when ending workout.
public event EventHandler WorkoutEnded
Event Type
EventHandler |
WorkoutStarted
Occurs when start workout.
public event EventHandler WorkoutStarted
Event Type
EventHandler |
WorkoutUpdate
Occurs when workout update occurs.
public event EventHandler<BikeWorkoutEventArgs> WorkoutUpdate
Event Type
EventHandler<BikeWorkoutEventArgs> |