mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-15 22:56:37 +01:00
72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
using System;
|
|
using TINK.Model.Connector;
|
|
using TINK.Model.Device;
|
|
using TINK.Model.User;
|
|
using TINK.Services.BluetoothLock;
|
|
using TINK.Services.Geolocation;
|
|
using TINK.View;
|
|
|
|
namespace TINK.ViewModel.Bikes.Bike
|
|
{
|
|
public static class BikeViewModelFactory
|
|
{
|
|
/// <param name="smartDevice">Provides info about the smart device (phone, tablet, ...).</param>
|
|
/// <param name="viewContext"> Holds the view context in which bike view model is used.</param>
|
|
/// <param name="stateInfoProvider">Provides in use state information.</param>
|
|
/// <param name="bikesViewModel">View model to be used for progress report and unlocking/ locking view.</param>
|
|
/// <param name="openUrlInBrowser">Delegate to open browser.</param>
|
|
public static BikeViewModelBase Create(
|
|
Func<bool> isConnectedDelegate,
|
|
Func<bool, IConnector> connectorFactory,
|
|
IGeolocationService geolocationService,
|
|
ILocksService lockService,
|
|
Action<string> bikeRemoveDelegate,
|
|
Func<IPollingUpdateTaskManager> viewUpdateManager,
|
|
ISmartDevice smartDevice,
|
|
IViewService viewService,
|
|
Model.Bikes.BikeInfoNS.BC.BikeInfoMutable bikeInfo,
|
|
IUser activeUser,
|
|
ViewContext viewContext,
|
|
IInUseStateInfoProvider stateInfoProvider,
|
|
IBikesViewModel bikesViewModel,
|
|
Action<string> openUrlInBrowser)
|
|
{
|
|
if (bikeInfo is Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfoMutable)
|
|
{
|
|
return new BluetoothLock.BikeViewModel(
|
|
isConnectedDelegate,
|
|
connectorFactory,
|
|
geolocationService,
|
|
lockService,
|
|
bikeRemoveDelegate,
|
|
viewUpdateManager,
|
|
smartDevice,
|
|
viewService,
|
|
bikeInfo as Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfoMutable,
|
|
activeUser,
|
|
viewContext,
|
|
stateInfoProvider,
|
|
bikesViewModel,
|
|
openUrlInBrowser);
|
|
}
|
|
if (bikeInfo is Model.Bikes.BikeInfoNS.CopriLock.BikeInfoMutable)
|
|
{
|
|
return new CopriLock.BikeViewModel(
|
|
isConnectedDelegate,
|
|
connectorFactory,
|
|
bikeRemoveDelegate,
|
|
viewUpdateManager,
|
|
smartDevice,
|
|
viewService,
|
|
bikeInfo,
|
|
activeUser,
|
|
viewContext,
|
|
stateInfoProvider,
|
|
bikesViewModel,
|
|
openUrlInBrowser);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|