Example #1
0
        void OnToolbarItemSelected(object sender, EToolbarItemEventArgs e)
        {
            if (_toolbar.SelectedItem == null || _isResettingToolbarItems)
            {
                return;
            }
            if (_isUpdateByCurrentPage || _isUpdateByScroller)
            {
                return;
            }
            _isUpdateByToolbar = true;

            var oldPage = Element.CurrentPage;
            var newPage = _itemToItemPage[_toolbar.SelectedItem];

            if (oldPage != newPage)
            {
                oldPage?.SendDisappearing();
                Element.CurrentPage = newPage;
                newPage?.SendAppearing();

                int index = MultiPage <Page> .GetIndex(newPage);

                _scroller.ScrollTo(index, 0, true);

                Element.UpdateFocusTreePolicy();
            }
            _isUpdateByToolbar = false;
        }
        /// <summary>
        /// A handler that be invoked when the current page is changed from tpage.
        /// </summary>
        /// <param name="sender">A sender</param>
        /// <param name="e">An event</param>
        void OnCurrentPageChanged(object sender, EToolbarItemEventArgs e)
        {
            if (_tpage.SelectedItem == null)
            {
                return;
            }

            /// To send a "SendDisappearing" event for the previous current page
            (Element.CurrentPage as IPageController)?.SendDisappearing();

            /// To set the new current page, show it and send a "SendAppearing" event for it
            Element.CurrentPage = _pageInfo[_tpage.SelectedItem].Page;
            ShowCurrentPage(_pageInfo[_tpage.SelectedItem]);
            (Element.CurrentPage as IPageController)?.SendAppearing();
        }
Example #3
0
        void OnCurrentPageChanged(object sender, EToolbarItemEventArgs e)
        {
            if (_tpage.SelectedItem == null)
            {
                return;
            }

            if (_tcontent != null)
            {
                _tcontent.Hide();
                _box.UnPack(_tcontent);
                (Element.CurrentPage as IPageController)?.SendDisappearing();
            }

            Element.CurrentPage = _itemToItemPage[_tpage.SelectedItem];
            _tcontent           = Platform.GetOrCreateRenderer(Element.CurrentPage).NativeView;
            _tcontent.SetAlignment(-1, -1);
            _tcontent.SetWeight(1, 1);
            _tcontent.Show();
            _box.PackEnd(_tcontent);
            (Element.CurrentPage as IPageController)?.SendAppearing();
        }
Example #4
0
        void OnToolbarItemSelected(object sender, EToolbarItemEventArgs e)
        {
            if (_toolbar.SelectedItem == null || _isResettingToolbarItems)
            {
                return;
            }

            var oldPage = Element.CurrentPage;
            var newPage = _itemToItemPage[_toolbar.SelectedItem];

            if (oldPage == newPage)
            {
                return;
            }

            oldPage?.SendDisappearing();

            Element.CurrentPage = newPage;
            newPage?.SendAppearing();

            int index = MultiPage <Page> .GetIndex(newPage);

            _scroller.ScrollTo(index, 0, true);
        }