mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-26 00:56:25 +01:00
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
|
|
||
|
namespace TINK.ViewModel.Bikes
|
||
|
{
|
||
|
/// 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>
|
||
|
FindBike,
|
||
|
/// <summary> Context is my bikes page. </summary>
|
||
|
MyBikes
|
||
|
}
|
||
|
}
|