2021-11-07 19:42:59 +01:00
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
|
2024-04-09 12:53:23 +02:00
|
|
|
|
namespace ShareeBike.View.Bike
|
2021-11-07 19:42:59 +01:00
|
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Selects different templates for different bike types (BordComputer bikes, iLockIt bikes).
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class BikeViewCellTemplateSelector : DataTemplateSelector
|
|
|
|
|
{
|
|
|
|
|
DataTemplate bCBike;
|
|
|
|
|
DataTemplate iLockIBike;
|
2021-11-07 19:42:59 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
public BikeViewCellTemplateSelector()
|
|
|
|
|
{
|
|
|
|
|
bCBike = new DataTemplate(typeof(BCBike));
|
|
|
|
|
iLockIBike = new DataTemplate(typeof(ILockItBike));
|
|
|
|
|
}
|
2021-11-07 19:42:59 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
|
2024-04-09 12:53:23 +02:00
|
|
|
|
=> item is ShareeBike.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel ||
|
|
|
|
|
item is ShareeBike.ViewModel.Bikes.Bike.CopriLock.BikeViewModel
|
2022-09-06 16:08:19 +02:00
|
|
|
|
? iLockIBike
|
|
|
|
|
: bCBike;
|
|
|
|
|
}
|
2021-11-07 19:42:59 +01:00
|
|
|
|
}
|