예제 #1
0
        private async void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {
            case GestureStatus.Running:
                // Translate and ensure we don't pan beyond the wrapped user interface element bounds.
                if (Math.Abs(e.TotalX) > Math.Abs(e.TotalY) && MainGrid.TranslationY == 0)
                {
                    MainGrid.TranslationX =
                        Math.Min(MainGrid.TranslationX + e.TotalX, Application.Current.MainPage.Width);
                    MainGrid1.TranslationX =
                        Math.Min(MainGrid1.TranslationX + e.TotalX, Application.Current.MainPage.Width);
                    MainGrid2.TranslationX =
                        Math.Max(MainGrid2.TranslationX + e.TotalX, 0);
                    //Content.TranslationY =
                    //  Math.Max(Math.Min(0, y + e.TotalY), -Math.Abs(Content.Height - App.ScreenHeight));
                    break;
                }
                else if (MainGrid.TranslationX == 0 && e.TotalY < 0)
                {
                    MainGrid.TranslationY =
                        Math.Max(MainGrid.TranslationY + e.TotalY, -Application.Current.MainPage.Height);
                    break;
                }
                break;



            case GestureStatus.Completed:
                // Store the translation applied during the pan
                if (-MainGrid.TranslationX > (Application.Current.MainPage.Width / 2) && (MainGrid.TranslationX < 0))
                {
                    NextTapped(null, null);
                    TranslateOriginal();
                }
                else if (MainGrid.TranslationX > (HalfWidth))
                {
                    PlayPreviousitem();
                    TranslateOriginal();
                }
                else if (-MainGrid.TranslationY > App.Current.MainPage.Height / 4)
                {
                    MainGrid.TranslateTo(0, ControlsLayout.Height - App.Current.MainPage.Height);
                    await ControlsLayout.TranslateTo(0, ControlsLayout.Height - App.Current.MainPage.Height);

                    UpSvg.RotateTo(180);
                    MainCollectionView.Margin    = new Thickness(0, ControlsLayout.Height, 0, 0);
                    MainCollectionView.IsVisible = true;
                    //CollectionStack.TranslateTo(0,-((ControlsLayout.Height) - App.Current.MainPage.Height));
                }
                else
                {
                    TranslateOriginalAnimate();
                }
                break;
            }
        }
예제 #2
0
        public async void TapGestureRecognizer_Tapped(object sender, EventArgs e)
        {
            if (MainCollectionView.IsVisible == true)
            {
                TranslateOriginal();
            }
            else
            {
                MainGrid.TranslateTo(0, ControlsLayout.Height - App.Current.MainPage.Height);
                await ControlsLayout.TranslateTo(0, ControlsLayout.Height - App.Current.MainPage.Height);

                UpSvg.RotateTo(180);
                MainCollectionView.Margin    = new Thickness(0, ControlsLayout.Height, 0, 0);
                MainCollectionView.IsVisible = true;
            }
        }
예제 #3
0
        private async void TranslateOriginal()
        {
            MainGrid.IsVisible = false;
            MainCollectionView.FadeTo(0);
            MainCollectionView.IsVisible = false;
            MainCollectionView.FadeTo(1);

            MainGrid.TranslationX = 0;
            MainGrid.TranslateTo(0, 0);
            ControlsLayout.TranslateTo(0, 0);
            bool c = await AwaiterF();

            MainGrid.IsVisible     = true;
            MainGrid2.TranslationX = Application.Current.MainPage.Width;
            MainGrid1.TranslationX = -(Application.Current.MainPage.Width);
            //CollectionStack.TranslationY = Application.Current.MainPage.Height;
        }