mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-23 15:46:29 +01:00
57 lines
2.2 KiB
C#
57 lines
2.2 KiB
C#
using System;
|
|
using TINK.Model.Connector;
|
|
using TINK.Services.BluetoothLock;
|
|
using TINK.Model.Services.Geolocation;
|
|
using TINK.Model.User;
|
|
using TINK.View;
|
|
using TINK.Model.Device;
|
|
|
|
namespace TINK.ViewModel.Bikes.Bike
|
|
{
|
|
public static class BikeViewModelFactory
|
|
{
|
|
/// <param name="smartDevice">Provides info about the smart device (phone, tablet, ...).</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>
|
|
public static BikeViewModelBase Create(
|
|
Func<bool> isConnectedDelegate,
|
|
Func<bool, IConnector> connectorFactory,
|
|
IGeolocation geolocation,
|
|
ILocksService lockService,
|
|
Action<string> bikeRemoveDelegate,
|
|
Func<IPollingUpdateTaskManager> viewUpdateManager,
|
|
ISmartDevice smartDevice,
|
|
IViewService viewService,
|
|
Model.Bike.BC.BikeInfoMutable bikeInfo,
|
|
IUser activeUser,
|
|
IInUseStateInfoProvider stateInfoProvider,
|
|
IBikesViewModel bikesViewModel)
|
|
{
|
|
return bikeInfo as Model.Bikes.Bike.BluetoothLock.IBikeInfoMutable != null
|
|
? new BluetoothLock.BikeViewModel(
|
|
isConnectedDelegate,
|
|
connectorFactory,
|
|
geolocation,
|
|
lockService,
|
|
bikeRemoveDelegate,
|
|
viewUpdateManager,
|
|
smartDevice,
|
|
viewService,
|
|
bikeInfo as Model.Bike.BluetoothLock.BikeInfoMutable,
|
|
activeUser,
|
|
stateInfoProvider,
|
|
bikesViewModel) as BikeViewModelBase
|
|
: new BC.BikeViewModel(
|
|
isConnectedDelegate,
|
|
connectorFactory,
|
|
bikeRemoveDelegate,
|
|
viewUpdateManager,
|
|
smartDevice,
|
|
viewService,
|
|
bikeInfo,
|
|
activeUser,
|
|
stateInfoProvider,
|
|
bikesViewModel);
|
|
}
|
|
}
|
|
}
|