public App() { current = this; InitializeComponent(); ViewModelBase.Init(); // The root page of your application switch (Device.OS) { case TargetPlatform.Android: MainPage = new RootPageAndroid(); break; case TargetPlatform.iOS: MainPage = new CXCognitiveNavigationPage(new RootPageiOS()); break; case TargetPlatform.Windows: case TargetPlatform.WinPhone: MainPage = new RootPageWindows(); break; default: throw new NotImplementedException(); } }
public MenuPage(RootPageAndroid root) { this.root = root; InitializeComponent(); NavView.NavigationItemSelected += (sender, e) => { this.root.IsPresented = false; Device.StartTimer(TimeSpan.FromMilliseconds(300), () => { Device.BeginInvokeOnMainThread(async() => { await this.root.NavigateAsync(e.Index); }); return(false); }); }; }
private async Task GetMainPage() { var repo = AppContainer.Container.Resolve<IRepository>(); var list = await repo.GetAllAsync<Host>(); if (!list.Any()) { var logger = AppContainer.Container.Resolve<ILogger>(); logger.Info("App start : No host in repository. Start first login."); //FirstLogin(); return; } var ssh = AppContainer.Container.Resolve<ISshService>(); Host host = null; if (Settings.Current.LastHostId > 0) host = list.First(l =>l.Id == Settings.Current.LastHostId); else host = list.First(); ssh.Host = host; ssh.Initialise(); switch (Device.RuntimePlatform) { case Device.Android: MainPage = new RootPageAndroid(); NavigationService.Navigation = MainPage.Navigation; break; case Device.iOS: NavigationService.GoToHome(); break; case Device.UWP: case Device.WinPhone: MainPage = new RootPageWindows(); NavigationService.Navigation = MainPage.Navigation; //await NavigationService.GoToRootPageWindows(); break; default: throw new NotImplementedException(); } }