Class ActivityViewModel
- Namespace
- Tudormobile.Strava.UI.ViewModels
- Assembly
- Tudormobile.Strava.UI.dll
Represents a view model for an activity, providing access to activity details and allowing updates to certain properties.
public class ActivityViewModel : INotifyPropertyChanged
- Inheritance
-
ActivityViewModel
- Implements
- Inherited Members
Remarks
This class serves as a bridge between the activity data model and the user interface, exposing activity details as read-only properties and allowing updates to specific fields such as the activity name, description, and type.
Constructors
ActivityViewModel()
Initializes a new instance of the ActivityViewModel class with a default DetailedActivity.
public ActivityViewModel()
ActivityViewModel(DetailedActivity)
Initializes a new instance of the ActivityViewModel class with the specified activity details.
public ActivityViewModel(DetailedActivity activity)
Parameters
activityDetailedActivityThe detailed activity data used to initialize the view model. Cannot be null.
Properties
Athlete
Athlete.
public AthleteId Athlete { get; }
Property Value
AverageSpeed
The activity's average speed, in meters per second
public double AverageSpeed { get; }
Property Value
Commute
Gets or sets a value indicating whether this activity is a commute.
public bool Commute { get; set; }
Property Value
Description
Gets or sets a description of the activity.
public string Description { get; set; }
Property Value
Distance
The activity's distance, in meters
public double Distance { get; }
Property Value
DoneCommand
Gets or sets the command to be executed when the "Done" action is triggered.
public ICommand? DoneCommand { get; set; }
Property Value
ElapsedTime
The activity's elapsed time, in seconds
public double ElapsedTime { get; }
Property Value
Id
The unique identifier of the activity
public long Id { get; }
Property Value
MaxSpeed
The activity's max speed, in meters per second
public double MaxSpeed { get; }
Property Value
MovingTime
The activity's moving time, in seconds
public double MovingTime { get; }
Property Value
Name
The name of the activity
public string Name { get; set; }
Property Value
SportType
Gets or sets the type of sport associated with the activity.
public SportTypes SportType { get; set; }
Property Value
StartDate
The time at which the activity was started.
public DateTime StartDate { get; }
Property Value
TotalElevationGain
The activity's total elevation gain.
public double TotalElevationGain { get; }
Property Value
Trainer
Gets or sets a value indicating whether this activity was recorded on a training machine.
public bool Trainer { get; set; }
Property Value
UpdateCommand
Gets or sets the command to update the activity.
public ICommand? UpdateCommand { get; set; }
Property Value
Methods
OnPropertyChanged(string)
Raises the PropertyChanged event to notify listeners that a property value has changed.
protected virtual void OnPropertyChanged(string propertyName)
Parameters
Remarks
This method is typically called by property setters to notify data-binding clients or other listeners of property changes. Subclasses can override this method to provide additional behavior when a property changes.
Events
PropertyChanged
Occurs when a property value changes.
public event PropertyChangedEventHandler? PropertyChanged
Event Type
Remarks
This event is typically used to notify subscribers that a property value has been updated. It is commonly implemented in classes that support data binding or need to signal changes to property values.