Exemplo n.º 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;
        }
Exemplo n.º 2
0
        void OnCurrentPageChanged()
        {
            // To update TabIndex order
            CustomFocusManager.StartReorderTabIndex();

            if (_isUpdateByScroller || _isUpdateByToolbar || !_isInitialized)
            {
                return;
            }

            _isUpdateByCurrentPage = true;
            Page oldPage = null;

            if (_toolbar.SelectedItem != null && _itemToItemPage.ContainsKey(_toolbar.SelectedItem))
            {
                oldPage = _itemToItemPage[_toolbar.SelectedItem];
            }

            oldPage?.SendDisappearing();
            Element.CurrentPage?.SendAppearing();

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

            _toolbarItemList[index].IsSelected = true;
            _scroller.ScrollTo(index, 0, true);

            Element.UpdateFocusTreePolicy();
            _isUpdateByCurrentPage = false;
        }
Exemplo n.º 3
0
        void OnInnerLayoutUpdate()
        {
            if (!_isInitialized)
            {
                return;
            }

            int   baseX = _innerBox.Geometry.X;
            ERect bound = _scroller.Geometry;
            int   index = 0;

            foreach (var page in Element.Children)
            {
                var nativeView = Platform.GetRenderer(page).NativeView;
                bound.X             = baseX + index * bound.Width;
                nativeView.Geometry = bound;
                index++;
            }
            _innerBox.MinimumWidth = Element.Children.Count * bound.Width;
            if (_toolbar.SelectedItem == null)
            {
                return;
            }
            int currentPage = MultiPage <Page> .GetIndex(_itemToItemPage[_toolbar.SelectedItem]);

            _scroller.ScrollTo(currentPage, 0, false);
        }
Exemplo n.º 4
0
        /*
         * public override void WillRotate (UIInterfaceOrientation toInterfaceOrientation, double duration)
         * {
         *      this.ignoreNativeScrolling = true;
         * }
         *
         * public override void DidRotate (UIInterfaceOrientation fromInterfaceOrientation)
         * {
         *      this.ignoreNativeScrolling = false;
         * }
         */

        private void UpdateCurrentPage(bool animated = true)
        {
            ContentPage currentPage = this.Carousel.CurrentPage;

            if (currentPage == null)
            {
                return;
            }
            this.ScrollToPage(MultiPage <ContentPage> .GetIndex(currentPage), animated);
        }
        private static void TabbedPageOnCurrentPageChanged(object sender, EventArgs e)
        {
            if (sender is SJTabbedPage sJTabbedPage && sJTabbedPage.IsEnabled)
            {
                var currentIndex = MultiPage <Page> .GetIndex(sJTabbedPage.CurrentPage);

                sJTabbedPage.SelectedIndex = currentIndex;
                var command = GetCurrentPageChangedCommand(sJTabbedPage);
                if (command != null && command.CanExecute(currentIndex))
                {
                    command.Execute(currentIndex);
                }
            }
        }
Exemplo n.º 6
0
        void SelectedNextTab(int direction)
        {
            int nextIndex = MultiPage <Page> .GetIndex(Tabbed.CurrentPage) + direction;

            if (nextIndex < 0 || nextIndex >= Tabbed.Children.Count)
            {
                return;
            }
            var nextPage = Tabbed.Children[nextIndex];

            UIView.Transition(
                Platform.GetRenderer(Tabbed.CurrentPage).NativeView,
                Platform.GetRenderer(nextPage).NativeView,
                0.05,
                UIViewAnimationOptions.TransitionCrossDissolve,
                null);
            Tabbed.CurrentPage = nextPage;
        }
Exemplo n.º 7
0
        private void OnPagesChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            this.ignoreNativeScrolling = true;
            int num1 = (int)NotifyCollectionChangedEventArgsExtensions.Apply(e, (Action <object, int, bool>)((o, i, c) => this.InsertPage((ContentPage)o, i)), (Action <object, int>)((o, i) => this.RemovePage((ContentPage)o, i)), new Action(this.Reset));

            this.PositionChildren();
            this.ignoreNativeScrolling = false;
            int num2 = 4;

            if (num1 != num2)
            {
                return;
            }
            int index = this.Carousel.CurrentPage != null ? MultiPage <ContentPage> .GetIndex(this.Carousel.CurrentPage) : 0;

            if (index < 0)
            {
                index = 0;
            }
            this.ScrollToPage(index, true);
        }
Exemplo n.º 8
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);
        }