HomePage.xaml.cs
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
namespace IndustrialControl.Pages
{
public partial class HomePage : ContentPage
{
public HomePage()
{
InitializeComponent();
}
private async void OnInMat(object sender, EventArgs e)
{
await Shell.Current.GoToAsync(nameof(InboundMaterialSearchPage));
}
private async void OnInProd(object sender, EventArgs e)
{
await Shell.Current.GoToAsync(nameof(InboundProductionPage));
}
private async void OnOutMat(object sender, EventArgs e)
{
await Shell.Current.GoToAsync(nameof(OutboundMaterialPage));
}
private async void OnOutFinished(object sender, EventArgs e)
{
await Shell.Current.GoToAsync(nameof(OutboundFinishedPage));
}
// 新增:退出登录
private async void OnLogoutClicked(object? sender, EventArgs e)
{
await TokenStorage.ClearAsync(); // 清除 token
ApiClient.SetBearer(null); // 清空请求头
// 切换到未登录的 Shell:显示 登录|日志|管理员
MainThread.BeginInvokeOnMainThread(() =>
{
App.SwitchToLoggedOutShell();
});
}
}
}