Files
ulapp/FieldLogger/Views/SettingsPage.xaml

76 lines
5.1 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:FieldLogger.ViewModels"
x:Class="FieldLogger.Views.SettingsPage"
x:DataType="vm:SettingsViewModel"
Title="Settings">
<ScrollView>
<VerticalStackLayout Padding="16" Spacing="12">
<Label Text="Devices" FontAttributes="Bold" FontSize="16" />
<Border StrokeThickness="0" Background="{AppThemeBinding Light=#F2F2F7, Dark=#1C1C1E}" StrokeShape="RoundRectangle 12" Padding="12">
<VerticalStackLayout Spacing="10">
<Grid ColumnDefinitions="16,*,Auto,Auto" ColumnSpacing="8">
<Ellipse WidthRequest="12" HeightRequest="12" VerticalOptions="Center"
Fill="{Binding Manager.LocatorState, Converter={StaticResource StateColor}}" />
<VerticalStackLayout Grid.Column="1" Spacing="0">
<Label Text="Locating Receiver" FontSize="12" TextColor="Gray" />
<Label Text="{Binding Manager.LocatorName, TargetNullValue='Not selected'}" FontAttributes="Bold" />
</VerticalStackLayout>
<Button Grid.Column="2" Text="Change" FontSize="12" Padding="10,4" Command="{Binding ChangeLocatorCommand}" />
<Button Grid.Column="3" Text="Forget" FontSize="12" Padding="10,4"
BackgroundColor="Transparent" TextColor="IndianRed" Command="{Binding ForgetLocatorCommand}" />
</Grid>
<BoxView HeightRequest="1" Color="{AppThemeBinding Light=#E0E0E0, Dark=#333}" />
<Grid ColumnDefinitions="16,*,Auto,Auto" ColumnSpacing="8">
<Ellipse WidthRequest="12" HeightRequest="12" VerticalOptions="Center"
Fill="{Binding Manager.GpsState, Converter={StaticResource StateColor}}" />
<VerticalStackLayout Grid.Column="1" Spacing="0">
<Label Text="Maglink RTK GPS" FontSize="12" TextColor="Gray" />
<Label Text="{Binding Manager.GpsName, TargetNullValue='Not selected'}" FontAttributes="Bold" />
</VerticalStackLayout>
<Button Grid.Column="2" Text="Change" FontSize="12" Padding="10,4" Command="{Binding ChangeGpsCommand}" />
<Button Grid.Column="3" Text="Forget" FontSize="12" Padding="10,4"
BackgroundColor="Transparent" TextColor="IndianRed" Command="{Binding ForgetGpsCommand}" />
</Grid>
</VerticalStackLayout>
</Border>
<Label Text="Map" FontAttributes="Bold" FontSize="16" Margin="0,12,0,0" />
<Border StrokeThickness="0" Background="{AppThemeBinding Light=#F2F2F7, Dark=#1C1C1E}" StrokeShape="RoundRectangle 12" Padding="12">
<VerticalStackLayout Spacing="6">
<Label Text="Google Maps API Key (Windows map view)" FontSize="12" TextColor="Gray" />
<Entry Text="{Binding MapsApiKey}" Placeholder="AIza…" IsPassword="False" />
<Label FontSize="11" TextColor="Gray"
Text="On Android the key is configured in AndroidManifest.xml; iOS and macOS use Apple Maps and need no key." />
</VerticalStackLayout>
</Border>
<Label Text="Sync" FontAttributes="Bold" FontSize="16" Margin="0,12,0,0" />
<Border StrokeThickness="0" Background="{AppThemeBinding Light=#F2F2F7, Dark=#1C1C1E}" StrokeShape="RoundRectangle 12" Padding="12">
<VerticalStackLayout Spacing="8">
<Grid ColumnDefinitions="*,Auto">
<Label Text="Durable cloud sync" VerticalOptions="Center" />
<Switch Grid.Column="1" IsToggled="{Binding MqttEnabled}" />
</Grid>
<Entry Text="{Binding MqttHost}" Placeholder="dev.hub.umagul.net" />
<Entry Text="{Binding MqttPort}" Placeholder="8884" Keyboard="Numeric" />
<Entry Text="{Binding MqttOrgId}" Placeholder="Organization ID / MQTT username" />
<Entry Text="{Binding MqttPassword}" Placeholder="New MQTT password (stored securely)" IsPassword="True" />
<Label Text="{Binding MqttClientId, StringFormat='Client: {0}'}" FontSize="10" TextColor="Gray" />
<Label Text="{Binding SyncStatus}" FontSize="12" TextColor="DodgerBlue" />
<Button Text="Save &amp; Connect" Command="{Binding SaveSyncCommand}" />
</VerticalStackLayout>
</Border>
<Label Text="{Binding AppVersion, StringFormat='Field Logger v{0}'}"
FontSize="11" TextColor="Gray" HorizontalOptions="Center" Margin="0,20,0,0" />
</VerticalStackLayout>
</ScrollView>
</ContentPage>