void AddTabBar()
{
var shell = Application.Current.MainPage as AppShell;
if (shell == null) return;
// Очищаем текущую структуру
shell.Items.Clear();
// Создаем нижнее меню (TabBar)
var tabBar = new TabBar
{
Items =
{
new Tab
{
Title = "Главная",
Icon = "globe.png",
Items = { new ShellContent { Route = "MainPage", ContentTemplate = new DataTemplate(typeof(Main)) } }
},
new Tab
{
Title = "VPN",
Icon = "vpn.png",
Items = { new ShellContent { ContentTemplate = new DataTemplate(typeof(Proxy)) } }
},
new Tab
{
Title = "Серверы",
Icon = "server.png",
Items = { new ShellContent { ContentTemplate = new DataTemplate(typeof(ServerList)) } }
},
new Tab
{
Title = "Чат",
Icon = "chat.png",
Items = { new ShellContent { ContentTemplate = new DataTemplate(typeof(Chat)) } }
},
new Tab
{
Title = "Магазин",
Icon = "shop.png",
Items = { new ShellContent { ContentTemplate = new DataTemplate(typeof(Shop)) } }
},
new Tab
{
Title = "Профиль",
Icon = "user_01.png",
Items = { new ShellContent { ContentTemplate = new DataTemplate(typeof(Profile)) } }
}
}
};
// Добавляем TabBar в Shell
shell.Items.Add(tabBar);
}
void AddToolbBar()
{
var shell = Application.Current.MainPage as AppShell;
if (shell == null) return;
// Очищаем текущую структуру
shell.Items.Clear();
// 1. Добавляем элементы в Shell
shell.Items.Add(new FlyoutItem
{
Title = "Главная",
Icon = "globe.png",
Items = { new ShellContent { Route = "MainPage", ContentTemplate = new DataTemplate(typeof(Main)) } }
});
shell.Items.Add(new FlyoutItem
{
Title = "Список серверов",
Icon = "server.png",
Items = { new ShellContent { ContentTemplate = new DataTemplate(typeof(ServerList)) } }
});
shell.Items.Add(new FlyoutItem
{
Title = "Чат",
Icon = "chat.png",
Items = { new ShellContent { ContentTemplate = new DataTemplate(typeof(Chat)) } }
});
shell.Items.Add(new FlyoutItem
{
Title = "Магазин",
Icon = "shop.png",
Items = { new ShellContent { ContentTemplate = new DataTemplate(typeof(Shop)) } }
});
shell.Items.Add(new FlyoutItem
{
Title = "Профиль",
Icon = "user_01.png",
Items = { new ShellContent { ContentTemplate = new DataTemplate(typeof(Profile)) } }
});
shell.Items.Add(new FlyoutItem
{
Title = "Proxy",
Icon = "vpn.png",
Items = { new ShellContent { ContentTemplate = new DataTemplate(typeof(Proxy)) } }
});
// 2. Регистрируем маршруты
//Routing.RegisterRoute("MainPage", typeof(Main));
//Routing.RegisterRoute("ProfilePage", typeof(Profile));
// 3. Активируем Flyout
shell.FlyoutBehavior = FlyoutBehavior.Flyout;
}