using SunlightAggregationTerminal.View; using ZXing.Multi; using ZXing.Net.Maui; namespace SunlightAggregationTerminal; public partial class ScanPage : ContentPage { private int mode; public ScanPage(int i) { InitializeComponent(); mode = i; } private async void OnBarcodesDetected(object sender, BarcodeDetectionEventArgs e) { var firstResult = e.Results?.FirstOrDefault(); if (firstResult is not null) { barcodeReader.IsDetecting = false; // 触发回调 if (mode == 0) QueryPage.OnScanQuery?.Invoke(firstResult.Value); if (mode == 3) LogPage.OnScanProfile?.Invoke(firstResult.Value); await Navigation.PopAsync(); } } }