2023-07-04 11:06:38 +02:00
|
|
|
|
2024-04-09 12:53:23 +02:00
|
|
|
namespace ShareeBike.ViewModel.Bikes
|
2023-07-04 11:06:38 +02:00
|
|
|
{
|
|
|
|
/// Holds the view context in which a view model is used.
|
|
|
|
public class ViewContext
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Constructs object.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="page">Value identifying the page to which view model relates to.</param>
|
|
|
|
/// <param name="stationId">Holds the id of the station if related page is <see cref="PageContext.BikesAtStation"/> ignored otherwise.</param>
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Holds the page to which view model is related to.
|
|
|
|
/// </summary>
|
|
|
|
public PageContext Page { get; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Holds the id of the station if related page is <see cref="PageContext.BikesAtStation"/> empty otherwise.
|
|
|
|
/// </summary>
|
|
|
|
public string StationId { get; } = string.Empty;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Holds the view context in which bikes view model is used.
|
|
|
|
/// </summary>
|
|
|
|
public enum PageContext
|
|
|
|
{
|
|
|
|
/// <summary> Context is bikes at station page. </summary>
|
|
|
|
BikesAtStation,
|
|
|
|
/// <summary> Context is find bike page. </summary>
|
2023-11-21 15:26:57 +01:00
|
|
|
SelectBike,
|
2023-07-04 11:06:38 +02:00
|
|
|
/// <summary> Context is my bikes page. </summary>
|
2024-04-09 12:53:23 +02:00
|
|
|
MyBikes,
|
2023-07-04 11:06:38 +02:00
|
|
|
}
|
|
|
|
}
|