client: Windows 客户端(WinUI3 壳 + agent-core;调试用 Electron 壳存档);localserver token 改为常数时间比较
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using EveryPublish.Client.Services;
|
||||
|
||||
namespace EveryPublish.Client.Pages;
|
||||
|
||||
public sealed partial class PairPage : Page
|
||||
{
|
||||
private ClientContext _ctx = null!;
|
||||
|
||||
public PairPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
_ctx = (ClientContext)e.Parameter;
|
||||
_ctx.Core.ReloadLocalJson();
|
||||
}
|
||||
|
||||
private async void Pair_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var code = CodeBox.Text.Trim();
|
||||
var name = NameBox.Text.Trim();
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
PairResult.Text = "请输入配对码";
|
||||
return;
|
||||
}
|
||||
PairButton.IsEnabled = false;
|
||||
PairResult.Text = "配对中...";
|
||||
var (ok, message) = await _ctx.Core.PairAsync(code, name);
|
||||
PairButton.IsEnabled = true;
|
||||
PairResult.Text = ok ? "配对成功,正在连接服务器(可到「状态」页查看)" : message;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user