namespace ShareeBike.ViewModel.Bikes
{
/// Holds the view context in which a view model is used.
public class ViewContext
{
///
/// Constructs object.
///
/// Value identifying the page to which view model relates to.
/// Holds the id of the station if related page is ignored otherwise.
public ViewContext(PageContext page, string stationId = null) {
Page = page;
if (page != PageContext.BikesAtStation)
{
// Station id must not contain a value if view context is not bikes at station page.
return;
}
StationId = stationId ?? string.Empty;
}
///
/// Holds the page to which view model is related to.
///
public PageContext Page { get; }
///
/// Holds the id of the station if related page is empty otherwise.
///
public string StationId { get; } = string.Empty;
}
///
/// Holds the view context in which bikes view model is used.
///
public enum PageContext
{
/// Context is bikes at station page.
BikesAtStation,
/// Context is find bike page.
SelectBike,
/// Context is my bikes page.
MyBikes,
}
}