protected override void OnStart() { ViewModelBase.Init(); var bottomBarPage = new HomeTabbedPage() { Title = "博客园" }; bottomBarPage.BackgroundColor = (Color)Xamarin.Forms.Application.Current.Resources["NavigationText"]; bottomBarPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom).SetOffscreenPageLimit(5).SetElevation(5); if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.Android) { var rootPage = new Pages.Android.RootPage(); rootPage.Children.Add(bottomBarPage); rootPage.Children.Add(new SearchPage()); var navigationPage = new XamNavigationPage(rootPage); navigationPage.BarTextColor = (Color)Xamarin.Forms.Application.Current.Resources["TitleText"]; navigationPage.BarBackgroundColor = (Color)Xamarin.Forms.Application.Current.Resources["NavigationText"]; MainPage = navigationPage; } else if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.iOS) { MainPage = new XamNavigationPage(bottomBarPage); } OnResume(); }
public App() { InitializeComponent(); Ioc.Bootstrapper.Bootstrap("Core", CoreBootstrap.Run); MainPage = new HomeTabbedPage(); }
protected override void OnElementChanged(ElementChangedEventArgs <RootPage> e) { base.OnElementChanged(e); var activity = (FormsAppCompatActivity)Context; if (e.NewElement != null) { foreach (var item in Element.Children) { if (item is HomeTabbedPage) { barPage = item as HomeTabbedPage; barPage.CurrentPageChanged += delegate(object sender, System.EventArgs ev) { if (barPage.CurrentPage is AccountPage) { Element.HasSearchBar = false; } else { Element.HasSearchBar = true; } }; } if (item is SearchPage) { searchPage = item as SearchPage; } } rootView = activity.LayoutInflater.Inflate(Resource.Layout.RootView, null) as LinearLayout; searchContainer = rootView.FindViewById <FrameLayout>(Resource.Id.search_view_container); searchEditContent = rootView.FindViewById <EditText>(Resource.Id.search_edit_content); searchEditContent.OnFocusChangeListener = this; searchEditContent.AddTextChangedListener(this); searchEditContent.SetOnEditorActionListener(this); searchBackButton = rootView.FindViewById <ImageButton>(Resource.Id.search_back_button); searchBackButton.SetOnClickListener(this); searchCloseButton = rootView.FindViewById <ImageButton>(Resource.Id.search_close_button); searchCloseButton.SetOnClickListener(this); rootContainer = rootView.FindViewById <FrameLayout>(Resource.Id.root_container); rootContainer.Id = rootContainer.GetHashCode(); ViewGroup.AddView(rootView); SwitchBarPage(); } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Xamarin.Forms.ListView> e) { base.OnElementChanged(e); if (e.NewElement != null) { var aListView = (AListView)Control; aListView.VerticalScrollBarEnabled = false; aListView.SetOnScrollListener(this); var _refresh = (SwipeRefreshLayout)aListView.Parent; if (_refresh != null) { _refresh.SetColorSchemeResources(Resource.Color.primary); } HomePage = this.Element.Parent.Parent.Parent as HomeTabbedPage; } }
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { var item = e.SelectedItem as MainMasterDetailPageMenuItem; if (item == null) { return; } Page page = null; switch (item.Id) { case MainMasterDetailPageMenuItem.MenuNames.Home: page = new HomeTabbedPage(); break; case MainMasterDetailPageMenuItem.MenuNames.SignIn: page = new SignInPage(); break; case MainMasterDetailPageMenuItem.MenuNames.Setting: page = new SettingPage(); break; default: throw new ArgumentOutOfRangeException(); } // var page = (Page)Activator.CreateInstance(item.TargetType); page.Title = item.Title; xDetailPage.PushAsync(page); //Detail = new NavigationPage(page); IsPresented = false; MasterPage.ListView.SelectedItem = null; }
public App() { InitializeComponent(); VersionTracking.Track(); SqliteUtil.Current.CreateAllTablesAsync(); AppCenter.Start("", typeof(Analytics), typeof(Crashes)); ViewModelBase.Init(); var bottomBarPage = new HomeTabbedPage() { Title = "博客园" }; bottomBarPage.BackgroundColor = Color.White; bottomBarPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom).SetOffscreenPageLimit(5).SetElevation(5F); bottomBarPage.Children.Add(new ArticlesTopTabbedPage()); bottomBarPage.Children.Add(new NewsTopTabbedPage()); bottomBarPage.Children.Add(new StatusesTopTabbedPage()); bottomBarPage.Children.Add(new QuestionsTopTabbedPage()); bottomBarPage.Children.Add(new AccountPage()); if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.Android) { var rootPage = new Pages.Android.RootPage(); rootPage.Children.Add(bottomBarPage); rootPage.Children.Add(new SearchPage()); MainPage = new XamNavigationPage(rootPage); } else if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.iOS) { MainPage = new XamNavigationPage(bottomBarPage); } }
public App() { InitializeComponent(); MainPage = new HomeTabbedPage(); }
void RootPush(Page newPage, TaskCompletionSource <bool> pushInfoOnCompletedTask = null) { //Device.BeginInvokeOnMainThread(async () => //{ try { if (newPage != null) { Application.Current.MainPage = new NavigationPage(newPage); } else { var homeTabbedPage = new HomeTabbedPage(); var profile = new NavigationPage(GetInitializedPage(Marabaka.Pages.Profile.ToString())) { Title = "Профиль", IconImageSource = "profile_on" }; var courses = new NavigationPage(GetInitializedPage(Marabaka.Pages.Temp.ToString())) { Title = "Курсы", IconImageSource = "courses" }; var issues = new NavigationPage(GetInitializedPage(Marabaka.Pages.Temp.ToString())) { Title = "Задания", IconImageSource = "issues" }; var tv = new NavigationPage(GetInitializedPage(Marabaka.Pages.Temp.ToString())) { Title = "Кружок.тв", IconImageSource = "tv" }; var notify = new NavigationPage(GetInitializedPage(Marabaka.Pages.Temp.ToString())) { Title = "Уведомления", IconImageSource = "notify" }; homeTabbedPage.Children.Add(profile); homeTabbedPage.Children.Add(courses); homeTabbedPage.Children.Add(issues); homeTabbedPage.Children.Add(tv); homeTabbedPage.Children.Add(notify); homeTabbedPage.CurrentPage = homeTabbedPage.Children[0]; Application.Current.MainPage = homeTabbedPage; } } catch (Exception e) { Console.WriteLine(e); pushInfoOnCompletedTask?.SetResult(false); } //}); }