feat: complete UM Trace iOS and field UI integration
This commit is contained in:
35
FieldLogger/Views/Controls/AppStatusBar.xaml
Normal file
35
FieldLogger/Views/Controls/AppStatusBar.xaml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView 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.Controls.AppStatusBar"
|
||||
x:DataType="vm:AppStatusViewModel">
|
||||
<Border BackgroundColor="{DynamicResource UlColorSurfaceStrong}"
|
||||
StrokeThickness="0" Padding="12,8">
|
||||
<Grid RowDefinitions="Auto,Auto" RowSpacing="4">
|
||||
<Grid ColumnDefinitions="*,*" ColumnSpacing="12">
|
||||
<HorizontalStackLayout Spacing="6">
|
||||
<Label Text="●" FontSize="13"
|
||||
TextColor="{Binding LocatorState, Converter={StaticResource StateColor}}"
|
||||
VerticalTextAlignment="Center" />
|
||||
<Label Text="{Binding LocatorStatus}" FontSize="12"
|
||||
TextColor="{DynamicResource UlColorOnStrong}"
|
||||
LineBreakMode="TailTruncation" />
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout Grid.Column="1" Spacing="6">
|
||||
<Label Text="●" FontSize="13"
|
||||
TextColor="{Binding GnssState, Converter={StaticResource StateColor}}"
|
||||
VerticalTextAlignment="Center" />
|
||||
<Label Text="{Binding GnssStatus}" FontSize="12"
|
||||
TextColor="{DynamicResource UlColorOnStrong}"
|
||||
LineBreakMode="TailTruncation" />
|
||||
</HorizontalStackLayout>
|
||||
</Grid>
|
||||
<Label Grid.Row="1" Text="{Binding PositionSummary}" FontSize="12"
|
||||
FontFamily="{StaticResource UlTypeFamilyMono}"
|
||||
TextColor="{DynamicResource UlColorOnStrong}"
|
||||
LineBreakMode="TailTruncation"
|
||||
SemanticProperties.Description="Current GNSS fix type, estimated accuracy, satellites, and correction age" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ContentView>
|
||||
40
FieldLogger/Views/Controls/AppStatusBar.xaml.cs
Normal file
40
FieldLogger/Views/Controls/AppStatusBar.xaml.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using FieldLogger.ViewModels;
|
||||
|
||||
namespace FieldLogger.Views.Controls;
|
||||
|
||||
public partial class AppStatusBar : ContentView
|
||||
{
|
||||
private IDispatcherTimer? _staleTimer;
|
||||
|
||||
public AppStatusBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnHandlerChanged()
|
||||
{
|
||||
base.OnHandlerChanged();
|
||||
|
||||
if (Handler is null)
|
||||
{
|
||||
_staleTimer?.Stop();
|
||||
_staleTimer = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_staleTimer is not null)
|
||||
return;
|
||||
|
||||
_staleTimer = Dispatcher.CreateTimer();
|
||||
_staleTimer.Interval = TimeSpan.FromSeconds(1);
|
||||
_staleTimer.Tick += (_, _) => (BindingContext as AppStatusViewModel)?.Refresh();
|
||||
_staleTimer.Start();
|
||||
(BindingContext as AppStatusViewModel)?.Refresh();
|
||||
}
|
||||
|
||||
protected override void OnBindingContextChanged()
|
||||
{
|
||||
base.OnBindingContextChanged();
|
||||
(BindingContext as AppStatusViewModel)?.Refresh();
|
||||
}
|
||||
}
|
||||
15
FieldLogger/Views/Controls/FloatingMenuButton.xaml
Normal file
15
FieldLogger/Views/Controls/FloatingMenuButton.xaml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="FieldLogger.Views.Controls.FloatingMenuButton">
|
||||
<Button Text="☰" FontSize="24" FontAttributes="Bold"
|
||||
WidthRequest="56" HeightRequest="56" CornerRadius="28"
|
||||
Padding="0" Margin="16"
|
||||
BackgroundColor="{DynamicResource UlColorPrimary}"
|
||||
TextColor="{DynamicResource UlColorOnPrimary}"
|
||||
BorderColor="{DynamicResource UlColorSurfaceRaised}" BorderWidth="2"
|
||||
Clicked="OnMenuClicked"
|
||||
SemanticProperties.Description="Open UM Trace menu"
|
||||
MinimumHeightRequest="{StaticResource UlTouchComfortable}"
|
||||
MinimumWidthRequest="{StaticResource UlTouchComfortable}" />
|
||||
</ContentView>
|
||||
15
FieldLogger/Views/Controls/FloatingMenuButton.xaml.cs
Normal file
15
FieldLogger/Views/Controls/FloatingMenuButton.xaml.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace FieldLogger.Views.Controls;
|
||||
|
||||
public partial class FloatingMenuButton : ContentView
|
||||
{
|
||||
public FloatingMenuButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnMenuClicked(object? sender, EventArgs e)
|
||||
{
|
||||
if (Shell.Current is not null)
|
||||
Shell.Current.FlyoutIsPresented = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user