Exemplo n.º 1
0
        public App()
        {
            // Loads and parses the associated XAML
            InitializeComponent();

            // All the cards that are set to not appear in the custom flash card deck are
            // stored in this dictionary. This happens in the CustomizeDeck class. We need
            // to get all of these out and restore their value each time the app starts
            for (int i = 0; i < allSigns.Count; i++)
            {
                if (Properties.ContainsKey(allSigns[i].Name))
                {
                    allSigns[i].UseAsFlashCard = false;
                }
            }

            // MainPage is a property of the base Application class. It's used
            // to set the starting (root) page of our application.
            //
            // NavigationPage sets the page into something that can be
            // added to the navigation stack. Allows the back arrow in the
            // Navigation Bar.

            if (Device.RuntimePlatform == (Device.iOS))
            {
                // Need custom renderer to prevent video crashes
                MainPage = new CustomTabs();
            }
            else
            {
                // No custom renderer needed for Android
                MainPage = new Tabs();
            }
        }
Exemplo n.º 2
0
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                tabsPage = (CustomTabs)e.NewElement;
            }
            else
            {
                tabsPage = (CustomTabs)e.OldElement;
            }

            try
            {
                var tabbarController = (UITabBarController)this.ViewController;
                if (null != tabbarController)
                {
                    tabbarController.ViewControllerSelected += OnTabbarControllerItemSelected;
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }