using Gallery.Resources; using Gallery.Resources.UI; using Gallery.Util; using Gallery.Util.Interface; using Gallery.Views; using Xamarin.Forms; namespace Gallery { public partial class AppShell : Shell { public static new AppShell Current => Shell.Current as AppShell; public static Thickness NavigationBarOffset { get; private set; } public static Thickness TotalBarOffset { get; private set; } public AppShell() { InitializeComponent(); #if DEBUG Log.Print($"folder: {Store.PersonalFolder}"); Log.Print($"cache: {Store.CacheFolder}"); #endif InitFlyouts(); } private void InitFlyouts() { IGallerySource @default = null; foreach (var source in App.GallerySources) { var s = source; if (@default == null) { @default = s; } var tab = new Tab { Title = Helper.GetResource(source.Name), Route = source.Route, Items = { new ShellContent { ContentTemplate = new DataTemplate(() => new GalleryPage(s)) } } } .DynamicResource(BaseShellItem.FlyoutIconProperty, source.FlyoutIconKey); flyoutItems.Items.Add(tab); } var route = @default?.Route ?? Routes.Option; GoToAsync($"//{route}"); } public void SetNavigationBarHeight(double height) { NavigationBarOffset = new Thickness(0, height, 0, 0); } public void SetStatusBarHeight(double navigation, double height) { TotalBarOffset = new Thickness(0, navigation + height, 0, 0); } } }