Files
ulapp/FieldLogger/Views/HomePage.xaml
2026-08-23 20:54:03 -05:00

203 lines
14 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"
xmlns:models="clr-namespace:FieldLogger.Models"
xmlns:controls="clr-namespace:FieldLogger.Views.Controls"
x:Class="FieldLogger.Views.HomePage"
x:DataType="vm:HomeViewModel"
Title="Debug"
BackgroundColor="{DynamicResource UlColorCanvas}">
<Grid RowDefinitions="Auto,*">
<controls:AppStatusBar x:Name="AppStatus" />
<ScrollView Grid.Row="1">
<VerticalStackLayout Padding="16" Spacing="16">
<VerticalStackLayout Spacing="4">
<Label Text="UM TRACE DEBUG" FontSize="14" FontAttributes="Bold" CharacterSpacing="1.5"
TextColor="{DynamicResource UlColorPrimary}" />
<Label Text="Capture diagnostics" Style="{StaticResource UlPageTitle}"
TextColor="{DynamicResource UlColorText}"
SemanticProperties.HeadingLevel="Level1" />
</VerticalStackLayout>
<Border Style="{StaticResource UlCard}" BackgroundColor="{DynamicResource UlColorSurfaceRaised}"
Stroke="{DynamicResource UlColorBorder}" StrokeThickness="1"
StrokeShape="RoundRectangle 12" Padding="16"
SemanticProperties.Description="Active job and local capture count">
<Grid RowDefinitions="Auto,Auto,Auto" ColumnDefinitions="*,Auto" RowSpacing="8" ColumnSpacing="12">
<Label Text="ACTIVE JOB" FontSize="14" FontAttributes="Bold"
TextColor="{DynamicResource UlColorTextMuted}" />
<Label Grid.Row="1" Text="{Binding ActiveJobName}" FontSize="22" FontAttributes="Bold"
TextColor="{DynamicResource UlColorText}" LineBreakMode="TailTruncation" />
<Label Grid.Row="2" Text="{Binding ActiveJobPointSummary}" FontSize="16"
TextColor="{DynamicResource UlColorTextMuted}" />
<Button Grid.RowSpan="3" Grid.Column="1" Style="{StaticResource UlButtonSecondary}"
Text="Jobs" Command="{Binding SelectJobCommand}"
MinimumHeightRequest="{StaticResource UlTouchMinimum}" MinimumWidthRequest="72" FontAttributes="Bold"
SemanticProperties.Description="Choose or review the active job" />
</Grid>
</Border>
<!-- Production capture remains receiver-triggered. This is deliberately guidance,
not an app button that would invent an unsupported device command. -->
<Border BackgroundColor="{DynamicResource UlColorPrimary}" StrokeThickness="0"
StrokeShape="RoundRectangle 20" Padding="20,16" MinimumHeightRequest="{StaticResource UlTouchPrimary}"
SemanticProperties.Description="Hardware capture action. Press the log button on the locating receiver.">
<Grid ColumnDefinitions="Auto,*" ColumnSpacing="12">
<Label Text="◎" FontSize="30" FontAttributes="Bold"
TextColor="{DynamicResource UlColorOnPrimary}" VerticalTextAlignment="Center" />
<VerticalStackLayout Grid.Column="1" Spacing="2" VerticalOptions="Center">
<Label Text="CAPTURE FROM RECEIVER" FontSize="18" FontAttributes="Bold"
TextColor="{DynamicResource UlColorOnPrimary}" />
<Label Text="{Binding CaptureReadinessText}" FontSize="14"
TextColor="{DynamicResource UlColorOnPrimary}" />
</VerticalStackLayout>
</Grid>
</Border>
<Button Style="{StaticResource UlButtonPrimaryField}"
Text="Choose an active job" IsVisible="{Binding HasNoActiveJob}"
Command="{Binding SelectJobCommand}" MinimumHeightRequest="{StaticResource UlTouchComfortable}" FontAttributes="Bold"
SemanticProperties.Description="Capture is blocked. Choose or create an active job." />
<Label Text="DEVICE STATUS" FontSize="14" FontAttributes="Bold"
TextColor="{DynamicResource UlColorTextMuted}"
SemanticProperties.HeadingLevel="Level2" />
<Grid ColumnDefinitions="*,*" ColumnSpacing="8">
<Border Style="{StaticResource UlCard}" BackgroundColor="{DynamicResource UlColorSurfaceRaised}"
Stroke="{DynamicResource UlColorBorder}" StrokeShape="RoundRectangle 12"
Padding="12" MinimumHeightRequest="96">
<VerticalStackLayout Spacing="4">
<Label Text="LOCATOR" FontSize="14" FontAttributes="Bold"
TextColor="{DynamicResource UlColorTextMuted}" />
<Label Text="{Binding Manager.LocatorName, TargetNullValue='Not selected'}"
FontSize="16" FontAttributes="Bold" TextColor="{DynamicResource UlColorText}"
LineBreakMode="TailTruncation" />
<Label Text="{Binding Manager.LocatorState, Converter={StaticResource StateText}}"
FontSize="14" TextColor="{DynamicResource UlColorTextMuted}" />
<Button Style="{StaticResource UlButtonSecondary}"
Text="Select locator" Command="{Binding SelectLocatorCommand}"
MinimumHeightRequest="{StaticResource UlTouchMinimum}" Margin="0,4,0,0"
SemanticProperties.Description="Select the locating receiver" />
</VerticalStackLayout>
</Border>
<Border Grid.Column="1" Style="{StaticResource UlCard}" BackgroundColor="{DynamicResource UlColorSurfaceRaised}"
Stroke="{DynamicResource UlColorBorder}" StrokeShape="RoundRectangle 12"
Padding="12" MinimumHeightRequest="96">
<VerticalStackLayout Spacing="4">
<Label Text="RTK GPS" FontSize="14" FontAttributes="Bold"
TextColor="{DynamicResource UlColorTextMuted}" />
<Label Text="{Binding Manager.GpsName, TargetNullValue='Not selected'}"
FontSize="16" FontAttributes="Bold" TextColor="{DynamicResource UlColorText}"
LineBreakMode="TailTruncation" />
<Label Text="{Binding Manager.GpsState, Converter={StaticResource StateText}}"
FontSize="14" TextColor="{DynamicResource UlColorTextMuted}" />
<Button Style="{StaticResource UlButtonSecondary}"
Text="Select GPS" Command="{Binding SelectGpsCommand}"
MinimumHeightRequest="{StaticResource UlTouchMinimum}" Margin="0,4,0,0"
SemanticProperties.Description="Select the Maglink RTK GPS receiver" />
</VerticalStackLayout>
</Border>
</Grid>
<Border Style="{StaticResource UlCard}" BackgroundColor="{DynamicResource UlColorSurfaceRaised}"
Stroke="{DynamicResource UlColorBorder}" StrokeShape="RoundRectangle 12" Padding="16">
<VerticalStackLayout Spacing="8">
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="12">
<Label Text="POSITION FIX" FontSize="14" FontAttributes="Bold"
TextColor="{DynamicResource UlColorTextMuted}" />
<Label Grid.Column="1" Text="{Binding FixStatusLabel}" FontSize="16" FontAttributes="Bold"
TextColor="{DynamicResource UlColorText}"
SemanticProperties.Description="Current GPS fix quality" />
</Grid>
<Label Text="{Binding FixSummary}" FontSize="18" FontFamily="{StaticResource UlTypeFamilyMono}"
TextColor="{DynamicResource UlColorText}" />
<Label Text="{Binding FixAccuracy}" FontSize="14"
TextColor="{DynamicResource UlColorTextMuted}" />
</VerticalStackLayout>
</Border>
<Border Style="{StaticResource UlCard}" BackgroundColor="{DynamicResource UlColorSurfaceRaised}"
Stroke="{DynamicResource UlColorBorder}" StrokeShape="RoundRectangle 12" Padding="16">
<Grid ColumnDefinitions="Auto,*" ColumnSpacing="10">
<Label Text="↕" FontSize="22" TextColor="{DynamicResource UlColorPrimary}" />
<VerticalStackLayout Grid.Column="1" Spacing="2">
<Label Text="SYNC STATUS" FontSize="14" FontAttributes="Bold"
TextColor="{DynamicResource UlColorTextMuted}" />
<Label Text="{Binding SyncStatus}" FontSize="16" FontAttributes="Bold"
TextColor="{DynamicResource UlColorText}"
SemanticProperties.Description="Current synchronization status" />
</VerticalStackLayout>
</Grid>
</Border>
<Grid ColumnDefinitions="*,Auto">
<Label Text="RECENT CAPTURES" FontSize="14" FontAttributes="Bold"
TextColor="{DynamicResource UlColorTextMuted}"
SemanticProperties.HeadingLevel="Level2" />
<Button Grid.Column="1" Style="{StaticResource UlButtonSecondary}"
Text="View map" Command="{Binding ViewMapCommand}"
MinimumHeightRequest="{StaticResource UlTouchMinimum}" MinimumWidthRequest="96"
SemanticProperties.Description="View captured points on the map" />
</Grid>
<CollectionView ItemsSource="{Binding RecentPoints}" HeightRequest="360"
SemanticProperties.Description="Ten most recent locally saved capture points">
<CollectionView.EmptyView>
<Border Style="{StaticResource UlCard}" BackgroundColor="{DynamicResource UlColorSurfaceRaised}"
Stroke="{DynamicResource UlColorBorder}"
StrokeShape="RoundRectangle 12" Padding="20">
<VerticalStackLayout Spacing="6">
<Label Text="No captures yet" Style="{StaticResource UlEmptyStateTitle}"
HorizontalTextAlignment="Center" TextColor="{DynamicResource UlColorText}" />
<Label Text="With an active job, press LOG on the receiver to save the first point."
Style="{StaticResource UlEmptyStateBody}"
FontSize="14" HorizontalTextAlignment="Center"
TextColor="{DynamicResource UlColorTextMuted}" />
</VerticalStackLayout>
</Border>
</CollectionView.EmptyView>
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="models:LoggedPoint">
<Border Style="{StaticResource UlJobRow}" BackgroundColor="{DynamicResource UlColorSurfaceRaised}"
Stroke="{DynamicResource UlColorBorder}"
StrokeShape="RoundRectangle 12" Padding="12" Margin="0,0,0,8"
MinimumHeightRequest="76">
<Grid ColumnDefinitions="*,Auto" RowDefinitions="Auto,Auto" RowSpacing="6" ColumnSpacing="12">
<Label FontSize="16" FontAttributes="Bold" TextColor="{DynamicResource UlColorText}">
<Label.Text>
<MultiBinding StringFormat="{}{0} · {1} Hz · depth {2}">
<Binding Path="Utility" Converter="{StaticResource UtilityName}" />
<Binding Path="Frequency" />
<Binding Path="DepthRaw" />
</MultiBinding>
</Label.Text>
</Label>
<Label Grid.Column="1" FontSize="14" TextColor="{DynamicResource UlColorTextMuted}"
Text="{Binding TimestampUtc, StringFormat='{0:HH:mm:ss}'}" />
<Label Grid.Row="1" Grid.ColumnSpan="2" FontSize="14" FontFamily="{StaticResource UlTypeFamilyMono}"
TextColor="{DynamicResource UlColorTextMuted}">
<Label.Text>
<MultiBinding StringFormat="{}{0:F7}, {1:F7} · {2}">
<Binding Path="Latitude" />
<Binding Path="Longitude" />
<Binding Path="FixStatus" Converter="{StaticResource FixStatusName}" />
</MultiBinding>
</Label.Text>
</Label>
</Grid>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Button Style="{StaticResource UlButtonSecondary}"
Text="Open device console" Command="{Binding OpenDeviceConsoleCommand}"
IsVisible="{Binding IsDeviceConsoleAvailable}"
MinimumHeightRequest="{StaticResource UlTouchMinimum}"
SemanticProperties.Description="Open raw locator and GNSS device messages" />
</VerticalStackLayout>
</ScrollView>
</Grid>
</ContentPage>