コード例 #1
0
        private async void OnFlick(object sender, ManipulationCompletedEventArgs e)
        {
            Point  transformedVelocity = GestureHelper.GetTransformNoTranslation(transform).Transform(e.FinalVelocities.LinearVelocity);
            double horizontalVelocity  = transformedVelocity.X;
            double verticalVelocity    = transformedVelocity.Y;

            var direction = GestureHelper.GetDirection(horizontalVelocity, verticalVelocity);

            if (direction == System.Windows.Controls.Orientation.Horizontal)
            {
                _pageNumber = 0;
                _viewModel.ItemViewModels.Clear();

                if (horizontalVelocity < 0)
                {
                    LoadNextCategory();
                }
                else
                {
                    LoadPreviousCategory();
                }

                _catIdFromQS = _feedManager.GetCategories()[_currentIndex].Id;
                UserBehaviorManager.Instance.Log(UserAction.CatEnter, _catIdFromQS.ToString());
                await BindingContent();

                BindingNavBar();

                _lastItemId = string.Empty;
                _feedManager.SetLastId <string>(string.Empty);
            }
        }
コード例 #2
0
        private void OnFlick(object sender, ManipulationCompletedEventArgs e)
        {
            if (_itemContainer.AllItemViewModels.Count == 1)
            {
                return;
            }

            Point  transformedVelocity = GestureHelper.GetTransformNoTranslation(transform).Transform(e.FinalVelocities.LinearVelocity);
            double horizontalVelocity  = transformedVelocity.X;
            double verticalVelocity    = transformedVelocity.Y;

            var direction = GestureHelper.GetDirection(horizontalVelocity, verticalVelocity);

            if (direction == System.Windows.Controls.Orientation.Horizontal)
            {
                if (horizontalVelocity < 0)
                {
                    LoadNextItem();
                }
                else
                {
                    LoadPreviousItem();
                }

                var item = _itemContainer.AllItemViewModels[_currentIndex];
                UserBehaviorManager.Instance.Log(UserAction.ItemEnter, item.FeedId.ToString());
            }

            //if (e.Direction == System.Windows.Controls.Orientation.Horizontal)
            //{
            //    if (e.HorizontalVelocity < 0)
            //        LoadNextItem();
            //    else
            //        LoadPreviousItem();

            //    var item = _itemContainer.AllItemViewModels[_currentIndex];
            //    UserBehaviorManager.Instance.Log(UserAction.ItemClick, item.FeedId.ToString());
            //}
        }