diff --git a/QueryPage.xaml.cs b/QueryPage.xaml.cs index f9bdba0..f838c4b 100644 --- a/QueryPage.xaml.cs +++ b/QueryPage.xaml.cs @@ -4,14 +4,18 @@ namespace SunlightAggregationTerminal; public partial class QueryPage : ContentPage { + // 定义一个静态的回调动作 + public static Action? OnScanQuery; + public QueryPage() { InitializeComponent(); WeakReferenceMessenger.Default.Register(this, (r, scannedValue) => - { + { ResultEntry.Text = scannedValue; - }); + }); + }; } private async void OnScanButtonClicked(object sender, EventArgs e) { diff --git a/View/LogPage.xaml.cs b/View/LogPage.xaml.cs index 663af70..aa82c33 100644 --- a/View/LogPage.xaml.cs +++ b/View/LogPage.xaml.cs @@ -7,14 +7,15 @@ namespace SunlightAggregationTerminal.View; public partial class LogPage : ContentPage { + public static Action? OnScanProfile; public LogPage() { InitializeComponent(); WeakReferenceMessenger.Default.Register(this, (r, scannedValue) => { - Enterprise.Text = scannedValue; - }); + Enterprise.Text = scannedValue; + }); } private void OnScanButtonClicked(object sender, EventArgs e)