AppShell.xaml.cs
1.9 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
47
48
49
50
51
52
53
54
55
56
57
58
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Maui.Controls;
namespace IndustrialControl
{
public partial class AppShell : Shell
{
public AppShell(IServiceProvider sp)
{
InitializeComponent();
// Tab: 登录
var login = new ShellContent
{
Title = "登录",
Route = "Login",
ContentTemplate = new DataTemplate(() => sp.GetRequiredService<Pages.LoginPage>())
};
// Tab: 主页
var home = new ShellContent
{
Title = "主页",
Route = "Home",
ContentTemplate = new DataTemplate(() => sp.GetRequiredService<Pages.HomePage>())
};
// Tab: 管理员
var admin = new ShellContent
{
Title = "管理员",
Route = "Admin",
ContentTemplate = new DataTemplate(() => sp.GetRequiredService<Pages.AdminPage>())
};
// Tab: 日志
var logs = new ShellContent
{
Title = "日志",
Route = "Logs",
ContentTemplate = new DataTemplate(() => sp.GetRequiredService<Pages.LogsPage>())
};
var tabBar = new TabBar();
tabBar.Items.Add(login);
tabBar.Items.Add(home);
tabBar.Items.Add(admin);
tabBar.Items.Add(logs);
Items.Add(tabBar);
Routing.RegisterRoute(nameof(Pages.InboundMaterialPage), typeof(Pages.InboundMaterialPage));
Routing.RegisterRoute(nameof(Pages.InboundProductionPage), typeof(Pages.InboundProductionPage));
Routing.RegisterRoute(nameof(Pages.OutboundMaterialPage), typeof(Pages.OutboundMaterialPage));
Routing.RegisterRoute(nameof(Pages.OutboundFinishedPage), typeof(Pages.OutboundFinishedPage));
}
}
}