mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 13:57:28 +02:00
Contact page shows operator specific info
This commit is contained in:
parent
e436e83c1d
commit
a58c33f005
51 changed files with 948 additions and 221 deletions
|
@ -11,6 +11,8 @@ using Serilog;
|
|||
using BikeInfo = TINK.Model.Bike.BC.BikeInfo;
|
||||
using IBikeInfoMutable = TINK.Model.Bikes.Bike.BC.IBikeInfoMutable;
|
||||
using System.Globalization;
|
||||
using TINK.Model.Station.Operator;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace TINK.Model.Connector
|
||||
{
|
||||
|
@ -34,37 +36,44 @@ namespace TINK.Model.Connector
|
|||
/// Gets all statsion for station provider and add them into station list.
|
||||
/// </summary>
|
||||
/// <param name="p_oStationList">List of stations to update.</param>
|
||||
public static StationDictionary GetStationsAllMutable(this StationsAllResponse p_oStationsAllResponse)
|
||||
public static StationDictionary GetStationsAllMutable(this StationsAvailableResponse stationsAllResponse)
|
||||
{
|
||||
// Get stations from Copri/ file/ memory, ....
|
||||
if (p_oStationsAllResponse == null
|
||||
|| p_oStationsAllResponse.stations == null)
|
||||
if (stationsAllResponse == null
|
||||
|| stationsAllResponse.stations == null)
|
||||
{
|
||||
// Latest list of stations could not be retrieved from provider.
|
||||
return new StationDictionary();
|
||||
}
|
||||
|
||||
Version.TryParse(p_oStationsAllResponse.copri_version, out Version l_oCopriVersion);
|
||||
Version.TryParse(stationsAllResponse.copri_version, out Version copriVersion);
|
||||
|
||||
var l_oStations = new StationDictionary(p_oVersion: l_oCopriVersion);
|
||||
var stations = new StationDictionary(p_oVersion: copriVersion);
|
||||
|
||||
foreach (var l_oStation in p_oStationsAllResponse.stations)
|
||||
foreach (var station in stationsAllResponse.stations)
|
||||
{
|
||||
if (l_oStations.GetById(l_oStation.Value.station) != null)
|
||||
if (stations.GetById(station.Value.station) != null)
|
||||
{
|
||||
// Can not add station to list of station. Id is not unique.
|
||||
throw new InvalidResponseException<StationsAllResponse>(
|
||||
string.Format("Station id {0} is not unique.", l_oStation.Value.station), p_oStationsAllResponse);
|
||||
throw new InvalidResponseException<StationsAvailableResponse>(
|
||||
string.Format("Station id {0} is not unique.", station.Value.station), stationsAllResponse);
|
||||
}
|
||||
|
||||
l_oStations.Add(new Station.Station(
|
||||
l_oStation.Value.station,
|
||||
l_oStation.Value.GetGroup(),
|
||||
l_oStation.Value.GetPosition(),
|
||||
l_oStation.Value.description));
|
||||
stations.Add(new Station.Station(
|
||||
station.Value.station,
|
||||
station.Value.GetGroup(),
|
||||
station.Value.GetPosition(),
|
||||
station.Value.description,
|
||||
new Data(station.Value.operator_data?.operator_name,
|
||||
station.Value.operator_data?.operator_phone,
|
||||
station.Value.operator_data?.operator_hours,
|
||||
station.Value.operator_data?.operator_email,
|
||||
!string.IsNullOrEmpty(station.Value.operator_data?.operator_color)
|
||||
? Color.FromHex(station.Value.operator_data?.operator_color)
|
||||
: (Color?)null)));
|
||||
}
|
||||
|
||||
return l_oStations;
|
||||
return stations;
|
||||
}
|
||||
|
||||
/// <summary> Gets account object from login response.</summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue