sharee.bike-App/Meinkonrad/TINK/View/MyBikes/MyBikesPage.xaml
2023-09-22 11:38:42 +02:00

137 lines
4.1 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
x:Class="TINK.View.MyBikes.MyBikesPage"
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
xmlns:sharedGui="clr-namespace:ShareeSharedGuiLib.View"
xmlns:rental_process="clr-namespace:TINK.ViewModel.Bikes;assembly=TINKLib"
xmlns:bikeRentalProcess="clr-namespace:ShareeSharedGuiLib.View.Bike.RentalProcess"
xmlns:local_bike="clr-namespace:TINK.View.Bike"
BackgroundColor="{DynamicResource background-color}"
Shell.FlyoutBehavior="{Binding FlyoutBehavior}"
Shell.NavBarIsVisible="{Binding IsIdle}">
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Image Style="{StaticResource Image-Navbar}"/>
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingMyBikes}"/>
</Grid>
</Shell.TitleView>
<ContentPage.Resources>
<ResourceDictionary>
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
<xct:MultiConverter x:Key="RentalProcessToVisibleConverter">
<xct:EnumToBoolConverter>
<xct:EnumToBoolConverter.TrueValues>
<rental_process:CurrentRentalProcess>CloseLock</rental_process:CurrentRentalProcess>
<rental_process:CurrentRentalProcess>EndRental</rental_process:CurrentRentalProcess>
</xct:EnumToBoolConverter.TrueValues>
</xct:EnumToBoolConverter>
<xct:InvertedBoolConverter />
</xct:MultiConverter>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<!--Grid for Bike(s) view and Running process in same row-->
<Grid>
<!--Bike(s) view-->
<Grid
IsVisible="{Binding RentalProcess.State, Converter={StaticResource RentalProcessToVisibleConverter}}"
Grid.Row="0"
RowSpacing="0"
RowDefinitions="1*,Auto">
<StackLayout
Grid.Row="0"
Spacing="0"
Orientation="Vertical">
<!--No Network Connection-->
<sharedGui:NotConnectedToNetView/>
<!--Bike data-->
<Grid
RowDefinitions="Auto,1*"
RowSpacing="0">
<!--Hint for Outdated Data.-->
<sharedGui:HintForRefreshingPageView
Grid.Row="0"/>
<!--Bike(s)-->
<ListView
Grid.Row="1"
x:Name="MyBikesListView"
BackgroundColor="{DynamicResource background-color}"
SelectionMode="None"
SelectedItem="{Binding SelectedBike}"
IsEnabled="{Binding IsIdle}"
HasUnevenRows="True"
SeparatorVisibility="None"
ItemTemplate="{StaticResource bikeTemplateSelector}"
IsPullToRefreshEnabled="True"
RefreshCommand="{Binding RefreshCommand}"
IsRefreshing="{Binding IsRefreshing}"/>
<!--No Bikes-->
<Label
Grid.Row="1"
Margin="20"
IsVisible="{Binding IsNoBikesOccupiedVisible}"
Text="{Binding NoBikesOccupiedText}"/>
</Grid>
</StackLayout>
<!--Info text-->
<Label
Grid.Row="1"
Text="{Binding StatusInfoText}"
IsVisible="{Binding Path=IsProcessWithRunningProcessView, Converter={StaticResource InvertedBoolConverter}}"
FontSize="Small"
TextColor="DimGray"
Padding="5"
HorizontalOptions="CenterAndExpand">
<Label.Triggers>
<DataTrigger
TargetType="Label"
Binding="{Binding Path=StatusInfoText.Length}" Value="0">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
<DataTrigger
TargetType="Label"
Binding="{Binding Path=StatusInfoText}" Value="Offline.">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
</Label.Triggers>
</Label>
</Grid>
<!--While process is running-->
<sharedGui:RunningProcessView
Grid.Row="0"
IsVisible="{Binding IsProcessWithRunningProcessView}"/>
<!--CloseLock View-->
<bikeRentalProcess:RentalProcessBookedOpenCloseLock
Grid.Row="0"/>
<!--EndRental View-->
<bikeRentalProcess:RentalProcessBookedClosedEndRental
Grid.Row="0"/>
</Grid>
</ContentPage.Content>
</ContentPage>