Пример #1
0
        private async void mainImage_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            //if (e.IsInertial)
            {
                PagePicture lpCurrent = (PagePicture)mainImage.Items[0];
                if (lpCurrent != null)
                {
                    Point currentpoint = e.Position;
                    if (currentpoint.X - initialpoint.X >= 5 && lpCurrent.Previous != null)//500 is the threshold value, where you want to trigger the swipe right event
                    {
                        await LibraryView.PictureImageLoad(lpCurrent.Previous, mainImage);

                        LibraryView.onPictureChanged(sender, new OnPictureChangedArgs(lpCurrent.Previous, "grid"));
                        e.Complete();
                    }
                    else if (currentpoint.X - initialpoint.X <= -5 && lpCurrent.Next != null)//500 is the threshold value, where you want to trigger the swipe right event
                    {
                        await LibraryView.PictureImageLoad(lpCurrent.Next, mainImage);

                        LibraryView.onPictureChanged(sender, new OnPictureChangedArgs(lpCurrent.Next, "grid"));
                        e.Complete();
                    }
                }
            }
        }
Пример #2
0
        private async void mainImage_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
        {
            if (Math.Abs(e.Velocities.Linear.X) > .1 || Math.Abs(e.Velocities.Linear.Y) > .1)
            {
                PagePicture lpCurrent = (PagePicture)mainImage.Items[0];
                PageFile    lpfFile   = null;
                if (lpCurrent != null)
                {
                    var step        = StepSize.small;
                    var directionUp = true;

                    if (Math.Abs(e.Velocities.Linear.X) > Math.Abs(e.Velocities.Linear.Y))
                    {
                        directionUp = (e.Velocities.Linear.X < 0);
                        if (Math.Abs(e.Velocities.Linear.X) > 2)
                        {
                            step = StepSize.large;
                        }
                    }
                    else
                    {
                        directionUp = (e.Velocities.Linear.Y < 0);
                        if (Math.Abs(e.Velocities.Linear.Y) > 2)
                        {
                            step = StepSize.series;
                        }
                        else
                        {
                            step = StepSize.seriesTag;
                        }
                    }

                    if (directionUp)
                    {
                        lpfFile = lpCurrent.StepNext(step);
                    }
                    else
                    {
                        lpfFile = lpCurrent.StepPrevious(step);
                    }

                    if (lpfFile != null)
                    {
                        await LibraryView.PictureImageLoad(lpfFile, mainImage);

                        LibraryView.onPictureChanged(sender, new OnPictureChangedArgs(lpfFile, "grid"));
                    }
                    else
                    {
                        e.Handled = false;
                    }
                }
            }
        }
Пример #3
0
        async void gridView_Tapped(object sender, TappedRoutedEventArgs e)
        {
            {
                PagePicture lpCurrent = (PagePicture)mainImage.Items[0];
                PageFile    lpfFile   = null;
                var         up        = false;

                if (lpCurrent != null)
                {
                    var position = e.GetPosition(mainImage);
                    var height3  = mainImage.ActualHeight / 3;
                    var width2   = mainImage.ActualWidth / 2;
                    var stepSize = StepSize.small;

                    if (position.X < 50 || position.X > mainImage.ActualWidth - 75)
                    {
                        up = position.X > mainImage.ActualWidth - 75;
                        if (position.Y < height3)
                        {
                            stepSize = StepSize.small;
                        }
                        else if (position.Y < 2 * height3)
                        {
                            stepSize = StepSize.large;
                        }
                        else
                        {
                            stepSize = StepSize.seriesTag;
                        }
                    }
                    else if (position.Y < 50 || position.Y > mainImage.ActualHeight - 75)
                    {
                        up       = position.Y > mainImage.ActualHeight - 75;
                        stepSize = StepSize.series;
                    }
                    else
                    {
                        e.Handled = false;
                        return;
                    }

                    if (up)
                    {
                        lpfFile = lpCurrent.StepNext(stepSize);
                    }
                    else
                    {
                        lpfFile = lpCurrent.StepPrevious(stepSize);
                    }

                    if (lpfFile != null)
                    {
                        await LibraryView.PictureImageLoad(lpfFile, mainImage);

                        LibraryView.onPictureChanged(sender, new OnPictureChangedArgs(lpfFile, "grid"));
                    }
                    else
                    {
                        e.Handled = false;
                    }
                }
            }
        }