public void AddViewToWindow(ViewController view) { var nib = view.CreateView(); var grid = view.GetView(); grid.Visibility = Visibility.Hidden; canvasGrid.Children.Add(nib); view.AfterCreate(); }
public void PushView(ViewController view) { AddViewToWindow(view); HandleNavigationBar(view); if (views.Count == 0) { views.Push(view); ResetViewToDefaults(view); view.GetView().Visibility = Visibility.Visible; view.OnShow(); } else { ViewController lastView = views.Peek(); views.Push(view); lastView.BeforeHide(); ResetViewToDefaults(view); view.BeforeShow(); UIAnimations.PushSwapViews(view.GetView(), lastView.GetView(), () => { lastView.OnHide(); view.OnShow(); }); } }
private void ResetViewToDefaults(ViewController destinationView) { if(destinationView.NavigationBarExists) { SetLeftButtonText(defaultLeftButtonText); SetRightButtonText(defaultRightButtonText); SetTitle(""); leftButtonAction = null; rightButtonAction = null; } }
private void HandleNavigationBar(ViewController view) { if (view.NavigationBarExists) { if(!this.views.Peek().NavigationBarExists) UIAnimations.PopInNavigationBar(this.navigationBar); } else { UIAnimations.PopOutNavigationBar(this.navigationBar); } }