You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using CommunityToolkit.Mvvm.Messaging;
|
|
|
|
|
|
|
|
|
|
namespace SunlightAggregationTerminal;
|
|
|
|
|
|
|
|
|
|
public partial class QueryPage : ContentPage
|
|
|
|
|
{
|
|
|
|
|
// 定义一个静态的回调动作
|
|
|
|
|
public static Action<string>? OnScanQuery;
|
|
|
|
|
|
|
|
|
|
public QueryPage()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
WeakReferenceMessenger.Default.Register<string>(this, (r, scannedValue) =>
|
|
|
|
|
{
|
|
|
|
|
ResultEntry.Text = scannedValue;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
private async void OnScanButtonClicked(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// 跳转到扫码页面
|
|
|
|
|
await Navigation.PushAsync(new ScanPage(0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 处理“回车/完成”按钮点击
|
|
|
|
|
/* private void OnEntryCompleted()
|
|
|
|
|
{
|
|
|
|
|
string inputText = ResultEntry.Text;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(inputText))
|
|
|
|
|
{
|
|
|
|
|
// 在这里处理用户手动输入的内容
|
|
|
|
|
// 例如:验证格式、跳转页面、或者搜索商品
|
|
|
|
|
//DisplayAlert("提示", $"你输入了: {inputText}", "确定");
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
}
|