sharee.bike-App/LastenradBayern/ShareeBike/View/Bike/ILockItBike.xaml.cs

44 lines
1.2 KiB
C#
Raw Normal View History

2021-11-07 19:42:59 +01:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2024-04-09 12:53:23 +02:00
using ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock;
2021-11-07 19:42:59 +01:00
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
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
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ILockItBike : ViewCell
{
public ILockItBike()
{
InitializeComponent();
}
2021-11-07 19:42:59 +01:00
2022-09-06 16:08:19 +02:00
protected override void OnBindingContextChanged()
{
base.OnBindingContextChanged();
2021-11-07 19:42:59 +01:00
2022-09-06 16:08:19 +02:00
if (Device.RuntimePlatform != Device.iOS)
// Update of size is only required for iOS.
return;
2021-11-07 19:42:59 +01:00
2024-04-09 12:53:23 +02:00
var viewModel = BindingContext as ShareeBike.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
2022-09-06 16:08:19 +02:00
if (viewModel == null)
return;
2021-11-07 19:42:59 +01:00
2022-09-06 16:08:19 +02:00
viewModel.PropertyChanged += (sender, e) =>
{
2024-04-09 12:53:23 +02:00
if (e.PropertyName == nameof(ShareeBike.ViewModel.Bikes.Bike.BC.RequestHandler.Base<IBikeInfoMutable>.IsButtonVisible)
|| e.PropertyName == nameof(ShareeBike.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler.Base.IsLockitButtonVisible))
2022-09-06 16:08:19 +02:00
{
// Force update of view cell on iOS.
2024-04-09 12:53:23 +02:00
// https://hausource.visualstudio.com/ShareeBike/_workitems/edit/132
2022-09-06 16:08:19 +02:00
ForceUpdateSize();
}
};
}
}
2021-11-07 19:42:59 +01:00
}