sharee.bike-App/LastenradBayern/ShareeBike/View/Settings/SettingsPage.xaml
2024-04-09 12:53:23 +02:00

309 lines
15 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"
x:Class="ShareeBike.View.Settings.SettingsPage"
xmlns:conv="clr-namespace:ShareeBike.View.Settings;assembly=SharedBusinessLogic"
xmlns:account="clr-namespace:ShareeBike.Model.User.Account;assembly=SharedBusinessLogic"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
BackgroundColor="{DynamicResource background-color}">
<ContentPage.Resources>
<conv:BackendPermissionsToVisibleConverter x:Key="Frame_Converter"/>
<conv:PermissionToVisibleConverter x:Key="SwitchTheme_Converter" VisibleFlag="{x:Static account:Permissions.SwitchTheme}"/>
<conv:PermissionToVisibleConverter x:Key="PickCopriServer_Converter" VisibleFlag="{x:Static account:Permissions.PickCopriServer}"/>
<conv:PermissionToVisibleConverter x:Key="ManagePolling_Converter" VisibleFlag="{x:Static account:Permissions.ManagePolling}"/>
<conv:PermissionToVisibleConverter x:Key="ManageCopriCacheExpiration_Converter" VisibleFlag="{x:Static account:Permissions.ManageCopriCacheExpiration}"/>
<conv:PermissionToVisibleConverter x:Key="PickLockServiceImplementation_Converter" VisibleFlag="{x:Static account:Permissions.PickLockServiceImplementation}"/>
<conv:PermissionToVisibleConverter x:Key="PickLocationServiceImplementation_Converter" VisibleFlag="{x:Static account:Permissions.PickLocationServiceImplementation}"/>
<conv:PermissionToVisibleConverter x:Key="PickLoggingLevel_Converter" VisibleFlag="{x:Static account:Permissions.PickLoggingLevel}"/>
<conv:PermissionToVisibleConverter x:Key="ReportLevel_Converter" VisibleFlag="{x:Static account:Permissions.ReportLevel}"/>
<conv:PermissionToVisibleConverter x:Key="ShowDiagnostics_Converter" VisibleFlag="{x:Static account:Permissions.ShowDiagnostics}"/>
<conv:PermissionToVisibleConverter x:Key="SwitchSiteCaching_Converter" VisibleFlag="{x:Static account:Permissions.SwitchNoSiteCaching}"/>
</ContentPage.Resources>
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingSettings}"/>
</Grid>
</Shell.TitleView>
<ContentPage.Content>
<ScrollView>
<StackLayout
Spacing="0">
<Frame
Padding="10"
Margin="0,10,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="true">
<Grid ColumnDefinitions="*,Auto">
<Label Text="{x:Static resources:AppResources.MarkingCenterMapToCurrentPos}"/>
<Switch Grid.Column="1" IsToggled="{Binding CenterMapToCurrentLocation}"/>
</Grid>
</Frame>
<!-- Filter on view ShareeBike/ Citybike -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding IsGroupFilterVisible}">
<StackLayout>
<Label Text="{x:Static resources:AppResources.MarkingShowHideBikesOfType}"/>
<ListView
HasUnevenRows="True"
HeightRequest="120"
x:Name="Filters">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell IsEnabled="{Binding IsEnabled}">
<Grid ColumnDefinitions="*,Auto">
<Label Text="{Binding Text}"/>
<Switch Grid.Column="1" IsToggled="{Binding IsActivated}"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</Frame>
<!-- Picker to select startup page -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource Frame_Converter}}">
<StackLayout>
<Label Text="{x:Static resources:AppResources.MarkingStartupPage}"/>
<Picker
ItemsSource="{Binding StartupSettings.ServicesTextList}"
SelectedItem="{Binding StartupSettings.ActiveText}"/>
</StackLayout>
</Frame>
<!-- Themes -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource Frame_Converter}}">
<StackLayout>
<Label
Text="Theme"
IsVisible="{Binding DebugLevel, Converter={StaticResource SwitchTheme_Converter}}"/>
<Picker
ItemsSource="{Binding Themes.ServicesTextList}"
SelectedItem="{Binding Themes.ActiveText}"
IsVisible="{Binding DebugLevel, Converter={StaticResource SwitchTheme_Converter}}"/>
</StackLayout>
</Frame>
<!-- COPRI server selection -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource Frame_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickCopriServer_Converter}}"
Text="{Binding CopriServerUriList.CopriServerUriDescription}"/>
<Picker
IsVisible="{Binding DebugLevel, Converter={StaticResource PickCopriServer_Converter}}"
ItemsSource="{Binding CopriServerUriList.ServerTextList}"
SelectedItem="{Binding CopriServerUriList.NextActiveServerText}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ManagePolling_Converter}}"
Text="{Binding Polling.PollingText}"/>
<Switch
IsVisible="{Binding DebugLevel, Converter={StaticResource ManagePolling_Converter}}"
IsToggled="{Binding Polling.IsActivated}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ManagePolling_Converter}}"
Text="{Binding Polling.PeriodeTotalSecondsText}"/>
<Stepper
IsVisible="{Binding DebugLevel, Converter={StaticResource ManagePolling_Converter}}"
Minimum="5"
Increment="5"
Maximum="600"
IsEnabled="{Binding Polling.IsActivated}"
Value="{Binding Polling.PeriodeTotalSeconds}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ManageCopriCacheExpiration_Converter}}"
Text="Time after which COPRI-cache expires [s]"/>
<Slider
IsVisible="{Binding DebugLevel, Converter={StaticResource ManageCopriCacheExpiration_Converter}}"
x:Name="expiresAfter"
Minimum="0"
Maximum="15"
Value="{Binding ExpiresAfterTotalSeconds}"/>
<Entry
IsVisible="{Binding DebugLevel, Converter={StaticResource ManageCopriCacheExpiration_Converter}}"
IsReadOnly="True"
Text="{Binding ExpiresAfterTotalSecondsText}"/>
</StackLayout>
</Frame>
<!-- Lock control -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLockServiceImplementation_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLockServiceImplementation_Converter}}"
Text="{x:Static resources:AppResources.MarkingLockControl}" />
<Picker
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLockServiceImplementation_Converter}}"
ItemsSource="{Binding LocksServices.Services.ServicesTextList}"
SelectedItem="{Binding LocksServices.Services.ActiveText}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLockServiceImplementation_Converter}}"
Text="Bluetooth Connect Timeout [sec]"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLockServiceImplementation_Converter}}"
Text="{Binding LocksServices.ConnectTimeoutSecText}"/>
<Stepper
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLockServiceImplementation_Converter}}"
Minimum="0.1"
Increment="0.25"
Maximum="60"
Value="{Binding LocksServices.ConnectTimeoutSec}"/>
</StackLayout>
</Frame>
<!-- Geolocation -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLocationServiceImplementation_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLocationServiceImplementation_Converter}}"
Text="{x:Static resources:AppResources.MarkingGeolocationControl}" />
<Picker
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLocationServiceImplementation_Converter}}"
ItemsSource="{Binding GeolocationServices.ServicesTextList}"
SelectedItem="{Binding GeolocationServices.ActiveText}"/>
</StackLayout>
</Frame>
<!-- Web site caching -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource SwitchSiteCaching_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource SwitchSiteCaching_Converter}}"
Text="{x:Static resources:AppResources.MarkingWebsiteCaching}"/>
<Switch
IsVisible="{Binding DebugLevel, Converter={StaticResource SwitchSiteCaching_Converter}}"
IsToggled="{Binding IsSiteCachingOnDisplayValue}"/>
</StackLayout>
</Frame>
<!-- Logging -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLoggingLevel_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLoggingLevel_Converter}}"
Text="{x:Static resources:AppResources.MarkingLoggingLevel}" />
<Picker
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLoggingLevel_Converter}}"
ItemsSource="{Binding LoggingLevels}"
SelectedItem="{Binding SelectedLoggingLevel}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLoggingLevel_Converter}}"
Text="Logdatei in externen Pfad schreiben"/>
<Switch
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLoggingLevel_Converter}}"
IsToggled="{Binding LogToExternalFolderDisplayValue}"
IsEnabled="{Binding IsLogToExternalFolderVisible}"/>
</StackLayout>
</Frame>
<!-- Logging -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource ReportLevel_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ReportLevel_Converter}}"
Text="{x:Static resources:AppResources.MarkingVerboseErrorMessage}" />
<Switch
IsVisible="{Binding DebugLevel, Converter={StaticResource ReportLevel_Converter}}"
IsToggled="{Binding IsReportLevelVerbose}"/>
</StackLayout>
</Frame>
<!-- Display of parameters -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
Text="Device Identifier" />
<Entry
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
IsEnabled="false"
Text="{Binding DeviceIdentifier}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
Text="Copri Sitzungkeks"/>
<Entry
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
IsEnabled="false"
Text="{Binding SessionCookie}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
Text="Interner Pfad (Einstell./ ggf. Logging)"/>
<Editor
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
IsEnabled="false"
Text="{Binding InternalPath}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
Text="Externer Pfad (Mock/ ggf. Logging)"/>
<Editor
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
IsEnabled="false"
Text="{Binding ExternalPath}"/>
</StackLayout>
</Frame>
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>