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

44 lines
1.1 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;
2022-08-30 15:42:25 +02:00
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
2021-11-07 19:42:59 +01:00
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace TINK.View.Bike
{
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
2022-09-06 16:08:19 +02:00
var viewModel = BindingContext as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
if (viewModel == null)
return;
2021-11-07 19:42:59 +01:00
2022-09-06 16:08:19 +02:00
viewModel.PropertyChanged += (sender, e) =>
{
if (e.PropertyName == nameof(TINK.ViewModel.Bikes.Bike.BC.RequestHandler.Base<IBikeInfoMutable>.IsButtonVisible)
|| e.PropertyName == nameof(TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler.Base.IsLockitButtonVisible))
{
// Force update of view cell on iOS.
// https://hausource.visualstudio.com/TINK/_workitems/edit/132
ForceUpdateSize();
}
};
}
}
2021-11-07 19:42:59 +01:00
}