Initial commit: FieldLogger MAUI app with Maglink BLE support
Added Maglink RTK GNSS receiver integration with correct BLE UUIDs and device name filtering (ML-* prefix). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
59
FieldLogger/ViewModels/JobDetailViewModel.cs
Normal file
59
FieldLogger/ViewModels/JobDetailViewModel.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using FieldLogger.Models;
|
||||
using FieldLogger.Services.Data;
|
||||
|
||||
namespace FieldLogger.ViewModels;
|
||||
|
||||
[QueryProperty(nameof(JobId), "jobId")]
|
||||
public sealed partial class JobDetailViewModel : ObservableObject
|
||||
{
|
||||
private readonly AppDatabase _database;
|
||||
|
||||
[ObservableProperty]
|
||||
private int _jobId;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _jobName = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private int _pointCount;
|
||||
|
||||
public ObservableCollection<LoggedPoint> Points { get; } = new();
|
||||
|
||||
public JobDetailViewModel(AppDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
}
|
||||
|
||||
public async Task RefreshAsync()
|
||||
{
|
||||
var job = await _database.GetJobAsync(JobId);
|
||||
if (job is null)
|
||||
return;
|
||||
|
||||
JobName = job.Name;
|
||||
var points = await _database.GetPointsAsync(JobId);
|
||||
PointCount = points.Count;
|
||||
Points.Clear();
|
||||
foreach (var p in points)
|
||||
Points.Add(p);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private Task ViewMapAsync() => Shell.Current.GoToAsync($"//map?jobId={JobId}");
|
||||
|
||||
[RelayCommand]
|
||||
private async Task DeletePointAsync(LoggedPoint point)
|
||||
{
|
||||
var confirmed = await Shell.Current.DisplayAlert("Delete Point",
|
||||
$"Delete point #{point.Id} logged {point.TimestampUtc.ToLocalTime():g}?", "Delete", "Cancel");
|
||||
if (!confirmed)
|
||||
return;
|
||||
|
||||
await _database.DeletePointAsync(point.Id);
|
||||
Points.Remove(point);
|
||||
PointCount = Points.Count;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user