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.
39 lines
1.0 KiB
39 lines
1.0 KiB
|
1 week ago
|
using CommunityToolkit.Mvvm.Messaging;
|
||
|
|
|
||
|
|
namespace SunlightAggregationTerminal;
|
||
|
|
|
||
|
|
public partial class QueryPage : ContentPage
|
||
|
|
{
|
||
|
1 week ago
|
// 定义一个静态的回调动作
|
||
|
|
public static Action<string>? OnScanQuery;
|
||
|
|
|
||
|
1 week ago
|
public QueryPage()
|
||
|
|
{
|
||
|
|
InitializeComponent();
|
||
|
|
|
||
|
|
WeakReferenceMessenger.Default.Register<string>(this, (r, scannedValue) =>
|
||
|
1 week ago
|
{
|
||
|
1 week ago
|
ResultEntry.Text = scannedValue;
|
||
|
1 week ago
|
});
|
||
|
|
};
|
||
|
1 week ago
|
}
|
||
|
|
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}", "确定");
|
||
|
|
}
|
||
|
|
}*/
|
||
|
|
|
||
|
|
}
|