mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-22 15:06:26 +01:00
Toggle either bike id input controls and lock management view implemented.
This commit is contained in:
parent
892563ac0f
commit
0c0baf1b10
3 changed files with 33 additions and 6 deletions
|
@ -12,11 +12,14 @@
|
||||||
<Frame>
|
<Frame>
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<Entry
|
<Entry
|
||||||
Placeholder="Bike id hier eingeben"
|
Placeholder="Fahrrad-Nummer bitte hier eingeben"
|
||||||
|
IsVisible="{Binding IsSelectBikeVisible}"
|
||||||
Text="{Binding BikeIdUserInput}">
|
Text="{Binding BikeIdUserInput}">
|
||||||
</Entry>
|
</Entry>
|
||||||
<Button
|
<Button
|
||||||
Text="Wählen"
|
Text="Rad Wählen"
|
||||||
|
IsEnabled="{Binding IsSelectBikeEnabled}"
|
||||||
|
IsVisible="{Binding IsSelectBikeVisible}"
|
||||||
Command="{Binding OnSelectBikeRequest}">
|
Command="{Binding OnSelectBikeRequest}">
|
||||||
</Button>
|
</Button>
|
||||||
<ListView
|
<ListView
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace TINK.View.Settings
|
||||||
/// <returns>Boolean value indicating whether object is visible or not.</returns>
|
/// <returns>Boolean value indicating whether object is visible or not.</returns>
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
return ((Permissions)(value)).HasFlag(VisibleFlag);
|
return ((Permissions)value).HasFlag(VisibleFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
|
|
@ -29,13 +29,33 @@ namespace TINK.ViewModel.FindBike
|
||||||
{
|
{
|
||||||
public class FindBikePageViewModel : BikesViewModel, INotifyCollectionChanged, INotifyPropertyChanged
|
public class FindBikePageViewModel : BikesViewModel, INotifyCollectionChanged, INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
|
private string bikeIdUserInput = string.Empty;
|
||||||
|
|
||||||
/// <summary> Text entered by user to specify a bike.</summary>
|
/// <summary> Text entered by user to specify a bike.</summary>
|
||||||
public string BikeIdUserInput { get; set; }
|
public string BikeIdUserInput
|
||||||
|
{
|
||||||
|
get => bikeIdUserInput;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == bikeIdUserInput)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bikeIdUserInput = value;
|
||||||
|
base.OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsSelectBikeEnabled)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Holds all bikes available.</summary>
|
/// <summary> Holds all bikes available.</summary>
|
||||||
public BikeCollection Bikes { get; set; }
|
public BikeCollection Bikes { get; set; }
|
||||||
|
|
||||||
|
/// <summary> Do not allow to select bike if id is not set.</summary>
|
||||||
|
public bool IsSelectBikeEnabled => BikeIdUserInput != null && BikeIdUserInput.Length > 0;
|
||||||
|
|
||||||
|
/// <summary> Hide id input fields as soon as bike is found.</summary>
|
||||||
|
public bool IsSelectBikeVisible => BikeCollection != null && BikeCollection.Count == 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs bike collection view model in case information about occupied bikes is available.
|
/// Constructs bike collection view model in case information about occupied bikes is available.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -65,6 +85,10 @@ namespace TINK.ViewModel.FindBike
|
||||||
ISmartDevice smartDevice,
|
ISmartDevice smartDevice,
|
||||||
IViewService viewService) : base(p_oUser, permissions, bluetoothLE, runtimPlatform, isConnectedDelegate, connectorFactory, geolocation, lockService, polling, postAction, smartDevice, viewService, () => new MyBikeInUseStateInfoProvider())
|
IViewService viewService) : base(p_oUser, permissions, bluetoothLE, runtimPlatform, isConnectedDelegate, connectorFactory, geolocation, lockService, polling, postAction, smartDevice, viewService, () => new MyBikeInUseStateInfoProvider())
|
||||||
{
|
{
|
||||||
|
CollectionChanged += (sender, eventargs) =>
|
||||||
|
{
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsSelectBikeVisible)));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -87,7 +111,7 @@ namespace TINK.ViewModel.FindBike
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Command object to bind select bike button to view model. </summary>
|
/// <summary> Command object to bind select bike button to view model. </summary>
|
||||||
public System.Windows.Input.ICommand OnSelectBikeRequest => new Xamarin.Forms.Command(async () => await SelectBike());
|
public System.Windows.Input.ICommand OnSelectBikeRequest => new Xamarin.Forms.Command(async () => await SelectBike(), () => IsSelectBikeEnabled);
|
||||||
|
|
||||||
/// <summary> Select a bike by ID</summary>
|
/// <summary> Select a bike by ID</summary>
|
||||||
public async Task SelectBike()
|
public async Task SelectBike()
|
||||||
|
|
Loading…
Reference in a new issue