Example #1
0
        private void SwipeGestureRecognizer_Swiped_1(object sender, SwipedEventArgs e)
        {
            int col = Grid.GetColumn(this.referee);
            int row = Grid.GetRow(this.referee);

            switch (e.Direction)
            {
            case SwipeDirection.Left:
                col--;
                break;

            case SwipeDirection.Right:
                col++;
                break;

            case SwipeDirection.Up:
                row--;
                break;

            case SwipeDirection.Down:
                row++;
                break;
            }
            if (col != ball_col || row != ball_row)
            {
                Grid.SetColumn(this.referee, col);
                Grid.SetRow(this.referee, row);
                referee_col = col;
                referee_row = row;
            }
        }
Example #2
0
        void OnSwiped(object sender, SwipedEventArgs e)
        {
            if (fileFound)
            {
                //logic to update rating based on which direction the user swiped
                //then get next picture.
                switch (e.Direction.ToString())
                {
                case "Up":
                    //skip rating for this picture and get next picture
                    break;

                //increase rating
                case "Right":
                    pictures[pictureIndex].increaseRating();
                    break;

                //decrease rating
                case "Left":
                    pictures[pictureIndex].decreaseRating();
                    break;
                }
                //get next picture looping back to front if we reach the end of the list
                pictureIndex     = (pictureIndex + 1) % pictures.Count();
                Box.Source       = pictures.ElementAt(pictureIndex).path;
                swipedLabel.Text = "Name: " + pictures[pictureIndex].name + "\tRating: " + pictures[pictureIndex].getRating() + "\nTags: " + pictures[pictureIndex].getAllTags();

                //rewrite the json file with updated rating
                json = JsonConvert.SerializeObject(pictures, Formatting.Indented);
                System.IO.File.WriteAllText(imagesPath, json);
            }
        }//end OnSwiped
 /*--------------------------*/
 /*Finder Controls/Navigation*/
 private async void FinderGoUp(object sender, SwipedEventArgs e)
 {
     if (Finder.TranslationY == 587.5)
     {
         await Finder.TranslateTo(0, 400, 200);
     }
 }
Example #4
0
        //Methode die durch Swipe aufgerufen wird (Event Listener)
        public void OnTableSwiped(object sender, SwipedEventArgs e)
        {
            //Anfangsdatum der jetzigen Hauptseite holen
            var date = DateTime.Parse(ConvertSingleInt(1) + "/" + ConvertSingleInt(month) + "/" + year + " 00:00:00", App.culture);
            //Anfangsdatum in Bezug auf den heutigen Monat holen
            var todaydate = DateTime.Parse(ConvertSingleInt(1) + "/" + ConvertSingleInt(DateTime.Today.Month) + "/" + DateTime.Today.Year + " 00:00:00", App.culture);

            switch (e.Direction)
            {
            case SwipeDirection.Left:
                //Ein Monat hinzufügen
                date = date.AddMonths(1);
                //Erlaube nur einen Monat in die Zukunft zu gehen
                if (date <= todaydate.AddMonths(1))
                {
                    //Überschreiben der Hauptseite eine Navigation zurück ist nicht mehr möglich!
                    App.Current.MainPage = new MainPage(date);
                }
                break;

            case SwipeDirection.Right:
                //Ein Monat abziehen
                date = date.AddMonths(-1);
                //Überschreiben der Hauptseite eine Navigation zurück ist nicht mehr möglich!
                App.Current.MainPage = new MainPage(date);

                break;

            default:
                break;
            }
        }
Example #5
0
        public void OnSwipeRight(object sender, SwipedEventArgs e)
        {
            var stack = (((sender as Grid).Parent.Parent as Grid).Children[1] as StackLayout);

            stack.IsVisible = false;

            var displayInfo = DeviceDisplay.MainDisplayInfo;
            var frame       = ((sender as Grid).Parent as Frame);
            var grid        = sender as Grid;

            if (Device.RuntimePlatform != Device.UWP)
            {
                grid.ColumnDefinitions[1].Width = new GridLength(.20, GridUnitType.Star);
                grid.ColumnDefinitions[2].Width = new GridLength(.35, GridUnitType.Star);
                grid.ColumnDefinitions[3].Width = new GridLength(.1, GridUnitType.Star);
                grid.ColumnDefinitions[4].Width = new GridLength(.25, GridUnitType.Star);
            }
            var label = grid.Children[2];

            label.IsVisible = true;

            Grid.SetColumnSpan(frame, 3);
            if (Device.RuntimePlatform == Device.UWP || DeviceDisplay.MainDisplayInfo.Density <= 2)
            {
                Grid.SetColumnSpan(stack, 2);
                Grid.SetColumn(stack, 1);
            }
        }
 private void CloseBottomSheet(object sender, SwipedEventArgs swipedEventArgs)
 {
     bottomSheet.TranslateTo(bottomSheet.X, Height + BOTTOM_SHEET_CLOSED_RATIO, BOTTOM_SHEET_ANIMATION_SPEED, Easing.SinIn);
     backgroundFade.FadeTo(0, BOTTOM_SHEET_ANIMATION_SPEED);
     backgroundFade.IsVisible = false;
     isBottomSheetOpen        = false;
 }
        private void SwipeGestureRecognizer_Swiped(object sender, SwipedEventArgs e)
        {
            // see if the animation is running
            if (this.AnimationIsRunning("TransitionAnimation"))
            {
                return;
            }

            // update the elements
            UpdateOffScreenElements();

            // user has swipped
            var onScreenHeadingSlideOut = new Animation(v => currentHeading.TranslationX = v, 0, -this.Width, Easing.SinIn);
            var onScreenHeadingFadeOut  = new Animation(v => currentHeading.Opacity = v, 1, 0, Easing.SinIn);
            var onScreenBodySlideOut    = new Animation(v => currentBody.TranslationX = v, 0, -this.Width, Easing.SinIn);
            var onScreenBodyFadeOut     = new Animation(v => currentBody.Opacity = v, 1, 0, Easing.SinIn);

            var offScreenHeadingSlideIn = new Animation(v => offscreenHeading.TranslationX = v, this.Width, 0, Easing.SinIn);
            var offScreenHeadingFadeIn  = new Animation(v => offscreenHeading.Opacity = v, 0, 1, Easing.SinIn);
            var offScreenBodySlideIn    = new Animation(v => offscreenBody.TranslationX = v, this.Width, 0, Easing.SinIn);
            var offScreenBodyFadeIn     = new Animation(v => offscreenBody.Opacity = v, 0, 1, Easing.SinIn);

            // animation for skia
            var skiaAnimation = new Animation(
                callback: v =>
            {
                transitionValue = v;
                ImageSkiaCanvas.InvalidateSurface();
            }, start: 0, end: 2);

            var outgoingImageAnimation = new Animation(
                callback: v =>
            {
                outgoingImageOffset = v;
                ImageSkiaCanvas.InvalidateSurface();
            }, start: 0, end: this.Width);

            var parentAnimation = new Animation();

            parentAnimation.Add(0, 1, onScreenHeadingSlideOut);
            parentAnimation.Add(0, 1, onScreenHeadingFadeOut);
            parentAnimation.Add(.2, 1, onScreenBodySlideOut);
            parentAnimation.Add(0, 1, onScreenBodyFadeOut);

            parentAnimation.Add(0, 1, offScreenHeadingSlideIn);
            parentAnimation.Add(0, 1, offScreenHeadingFadeIn);
            parentAnimation.Add(.2, 1, offScreenBodySlideIn);
            parentAnimation.Add(0, 1, offScreenBodyFadeIn);

            parentAnimation.Add(0, 1, skiaAnimation);
            parentAnimation.Add(0.5, 1, outgoingImageAnimation);

            parentAnimation.Commit(this, "TransitionAnimation", 16, 800, null,
                                   (v, c) =>
            {
                viewModel.MoveNext();
                CycleElement();
                currentBitmap = offscreenBitmap;
            });
        }
Example #8
0
        //Swiping up will delete the card and take the user back to the subject page if then then press delete on the popup
        //Swiping down will show the user the answer; giving them the option to either press the button or use a gesture
        private async void SwipeContainer_Swipe(object sender, SwipedEventArgs e)
        {
            if (e.Direction == SwipeDirection.Up)
            {
                bool popupResult = await DisplayAlert("Alert", "Are you sure you want to delete this card?", "Delete", "Cancel");


                if (popupResult)
                {
                    ArrayControl.deleteCard(pubSelectedSubject, pubSelectedCard);


                    this.Navigation.RemovePage(this);


                    pubSubjectPage.updateCards();
                }
            }
            else if (e.Direction == SwipeDirection.Down)
            {
                answer.IsVisible = true;

                BackgroundImageSource = ImageSource.FromResource("FlashCardsApp.CardBackgroundOpen.png");
            }
        }
Example #9
0
        private void SwipeGestureRecognizer_Swiped(object sender, SwipedEventArgs e)
        {
            if (sender is Label == false)
            {
                return;
            }

            Label lbl = sender as Label;

            switch (e.Direction)
            {
            case SwipeDirection.Left:
                lbl.Text = "滑动我 - 正在向左滑动";
                break;

            case SwipeDirection.Up:
                lbl.Text = "滑动我 - 正在向上滑动";
                break;

            case SwipeDirection.Right:
                lbl.Text = "滑动我 - 正在向右滑动";
                break;

            case SwipeDirection.Down:
                lbl.Text = "滑动我 - 正在向下滑动";
                break;
            }
        }
 private void TopFrame_UpSwiped(object sender, SwipedEventArgs e)
 {
     if (TabBar.IsVisible && TabListDropdownBtn.IsEnabled)
     {
         HideTabList();
     }
 }
Example #11
0
        public static void OnConversionGridSwiped(object sender, SwipedEventArgs e)
        {
            switch (e.Direction)
            {
            case SwipeDirection.Left:
                loadGrid(leftButtonIdx + 1);
                break;

            case SwipeDirection.Right:              // swipe right appears to be moving finger from right to left in relation to user
                if (leftButtonIdx > 0)
                {
                    loadGrid(leftButtonIdx - 1);
                }
                break;

            case SwipeDirection.Up:
                // Handle the swipe
                break;

            case SwipeDirection.Down:
                // Handle the swipe
                break;

            default:
                loadGrid(leftButtonIdx + 1);
                break;
            }
        }
 private void TopFrame_DownSwiped(object sender, SwipedEventArgs e)
 {
     if (!TabBar.IsVisible && TabListDropdownBtn.IsEnabled)
     {
         ShowTabList();
     }
 }
Example #13
0
        void OnSwiped(object sender, SwipedEventArgs e)
        {
            count++;
            countLbl.Text = $"Swipe: {count}";
            switch (e.Direction)
            {
            case SwipeDirection.Left:
                // Handle the swipe
                Debug.WriteLine("SWIPED Left");
                SwipeLeft();
                break;

            case SwipeDirection.Right:
                // Handle the swipe
                Debug.WriteLine("SWIPED Right");
                SwipeRight();
                break;

            case SwipeDirection.Up:
                // Handle the swipe
                Debug.WriteLine("SWIPED up");
                SwipeUpAnimateAsync();
                break;

            case SwipeDirection.Down:
                // Handle the swipe
                Debug.WriteLine("SWIPED Down");
                SwipeDownAnimateAsync();
                break;
            }
        }
 private void OnLeftSwipe(object sender, SwipedEventArgs e)
 {
     currentDateTime = currentDateTime.AddDays(7);
     selectedDate    = currentDateTime;
     CreateDayView(currentDateTime);
     scrollStack.Content = CreateGrid(currentDateTime);
 }
Example #15
0
        void OnSwiped(object sender, SwipedEventArgs e)
        {
            if (fileFound)
            {
                //logic to update rating based on which direction the user swiped
                //then get next picture.
                switch (e.Direction.ToString())
                {
                case "Up":

                    break;

                //Add the selected tag from the current picture
                case "Right":
                    pictureIndex = (pictureIndex + 1) % pictures.Count();
                    break;

                //Remove the selected tag from the selected picture
                case "Left":
                    if (pictureIndex == 0)
                    {
                        pictureIndex = pictures.Count() - 1;
                    }
                    else
                    {
                        pictureIndex = (pictureIndex - 1) % pictures.Count();
                    }
                    break;
                }


                Box.Source       = pictures.ElementAt(pictureIndex).path;
                swipedLabel.Text = "Name: " + pictures[pictureIndex].name + "\tRating: " + pictures[pictureIndex].getRating() + "\nTags: " + pictures[pictureIndex].getAllTags() + "\nDistance: " + pictures[pictureIndex].distance;
            }
        }//end OnSwiped
        void OnSwiped(object sender, SwipedEventArgs e)
        {
            if (fileFound)
            {
                //logic to update rating based on which direction the user swiped
                //then get next picture.
                switch (e.Direction.ToString())
                {
                case "Up":
                    break;

                case "Right":
                    pictureIndex = (pictureIndex + 1) % pictures.Count();
                    break;

                case "Left":
                    if (pictureIndex == 0)
                    {
                        pictureIndex = pictures.Count() - 1;
                    }
                    else
                    {
                        pictureIndex = (pictureIndex - 1) % pictures.Count();
                    }
                    break;
                }
                //get next picture looping back to front if we reach the end of the list

                Box.Source       = pictures.ElementAt(pictureIndex).path;
                swipedLabel.Text = "Name: " + pictures[pictureIndex].name + "\tRating: " + pictures[pictureIndex].getRating() + "\nTags: " + pictures[pictureIndex].getAllTags() + "\nDate and Time: " + pictures[pictureIndex].dateTime;
            }
        }//end OnSwiped
        private void TabContent_Swiped(object sender, SwipedEventArgs e)
        {
            lock (_syncRoot)
            {
                if (ItemsSource == null)
                {
                    return;
                }
                if (SelectedItem == null)
                {
                    return;
                }
                var index = ItemsSource.ToList().IndexOf(SelectedItem);
                switch (e.Direction)
                {
                case SwipeDirection.Left:
                    UpdateSelectedItem(index + 1);
                    break;

                case SwipeDirection.Right:
                    UpdateSelectedItem(index - 1);
                    break;
                }
            }
        }
        void OnSwipedEvaluation(object sender, SwipedEventArgs e)
        {
            if (e.Direction.ToString() == "Left")
            {
                LineEvaluation.IsVisible = false;
                LineImage.IsVisible      = false;
                LineEvolution.IsVisible  = true;

                CollectionEvolution.IsVisible   = true;
                CollectionImagens.IsVisible     = false;
                CollectionEvaluations.IsVisible = false;
                BindingContext = new EvolutionsPatientViewModel();
            }
            else if (e.Direction.ToString() == "Right")
            {
                LineEvaluation.IsVisible = false;
                LineEvolution.IsVisible  = false;
                LineImage.IsVisible      = true;

                CollectionEvolution.IsVisible   = false;
                CollectionEvaluations.IsVisible = false;
                CollectionImagens.IsVisible     = true;
                BindingContext = new ImagePatientViewModel();
            }
        }
Example #19
0
        private void SwipeGestureRecognizer_Swiped(object sender, SwipedEventArgs e)
        {
            switch (e.Direction)
            {
            case SwipeDirection.Left:
                Card.Animate(new FlipAnimation
                {
                    Direction = FlipAnimation.FlipDirection.Left,
                    Duration  = "500",
                    Easing    = EasingType.SpringIn
                });
                TurkishWord.Text = UserRepository.GetTurkishWord(EnglishWord.Text);
                break;

            case SwipeDirection.Right:
                Card.Animate(new FlipAnimation
                {
                    Direction = FlipAnimation.FlipDirection.Right,
                    Duration  = "500",
                    Easing    = EasingType.Linear
                });
                TurkishWord.Text = UserRepository.GetTurkishWord(EnglishWord.Text);
                break;
            }
        }
Example #20
0
 private void SwipeGestureRecognizer_Swiped(object sender, SwipedEventArgs e)
 {
     ViewModel.IsOpenCustom         = false;
     ViewModel.IsOpenSimpleSnackBar = false;
     ViewModel.IsOpenSimple         = false;
     ViewModel.IsOpenLeftCustom     = false;
 }
        void OnSwiped(object sender, SwipedEventArgs e)
        {
            if (fileFound)
            {
                //logic to update rating based on which direction the user swiped
                //then get next picture.
                switch (e.Direction.ToString())
                {
                case "Up":

                    break;

                //Add the selected tag from the current picture
                case "Right":
                    pictureIndex = (pictureIndex + 1) % pictures.Count();
                    break;

                //Remove the selected tag from the selected picture
                case "Left":
                    pictureIndex = (pictureIndex - 1) % pictures.Count();

                    break;
                }


                Box.Source       = pictures.ElementAt(Math.Abs(pictureIndex)).path;
                swipedLabel.Text = "Name: " + pictures[Math.Abs(pictureIndex)].name + "\tRating: " + pictures[Math.Abs(pictureIndex)].getRating() + "\nTags: " + pictures[Math.Abs(pictureIndex)].getAllTags() + "\nDistance: " + pictures[Math.Abs(pictureIndex)].distance;

                //rewrite the json file with updated rating
                json = JsonConvert.SerializeObject(pictures, Formatting.Indented);
                System.IO.File.WriteAllText(imagesPath, json);
            }
        }//end OnSwiped
        private async void SwipeGestureRecognizer_Swiped_Right(object sender, SwipedEventArgs e)
        {
            if (model.TrenutnaSlika > 0)
            {
                uint   transitionTime = 300;
                double displacement   = PrikazanaSlikaImage.Width;

                await Task.WhenAll(
                    PrikazanaSlikaImage.FadeTo(0, transitionTime, Easing.Linear),
                    PrikazanaSlikaImage.TranslateTo(displacement, PrikazanaSlikaImage.Y, transitionTime, Easing.CubicInOut));

                model.TrenutnaSlika--;
                if (model.TrenutnaSlika < 0)
                {
                    model.TrenutnaSlika = 0;
                }

                model.PrikazanaSlika = model.SlikeList[model.TrenutnaSlika].Slika;

                await PrikazanaSlikaImage.TranslateTo(-displacement, 0, 0);

                await Task.WhenAll(
                    PrikazanaSlikaImage.FadeTo(1, transitionTime, Easing.Linear),
                    PrikazanaSlikaImage.TranslateTo(0, PrikazanaSlikaImage.Y, transitionTime, Easing.CubicInOut));
            }
        }
Example #23
0
        public void OnSwiped(object sender, SwipedEventArgs e)
        {
            switch (e.Direction)
            {
            case SwipeDirection.Left:
                Game.Left();
                break;

            case SwipeDirection.Right:
                Game.Right();
                break;

            case SwipeDirection.Up:
                Game.Up();
                break;

            case SwipeDirection.Down:
                Game.Down();
                break;
            }
            updateBoard();
            scoreLabel.Text = Game.Score.ToString();
            if (Game.gameOver)
            {
                DisplayAlert("Game Over", "Click New Game to start again", "OK");
            }
            if (Game.isWin)
            {
                DisplayAlert("You won", "If you want to continue click OK or New Game to start again", "OK");
            }
        }
Example #24
0
 private async void SwipeGestureRecognizer_Swiped(object sender, SwipedEventArgs e)
 {
     if (e.Direction == SwipeDirection.Left)
     {
         if (selectionIndex + 1 == 5)
         {
             await ShowSelection(0);
         }
         else
         {
             await ShowSelection(selectionIndex + 1);
         }
     }
     else
     {
         if (selectionIndex - 1 == -1)
         {
             await ShowSelection(4);
         }
         else
         {
             await ShowSelection(selectionIndex - 1);
         }
     }
 }
Example #25
0
        private void SwipeGestureRecognizer_Swiped(object sender, SwipedEventArgs e)
        {
            var layout = (BindableObject)sender;
            var item   = (Item)layout.BindingContext;

            viewModel.DataStore.DeleteItemAsync(item.Id);
        }
Example #26
0
        //Rotates through the Categories array onSwipe. Gets current Position in Array and returns next or jumps to first
        public String SwipeCat(SwipedEventArgs e, String orig)
        {
            string[] Categories = new string[5] {
                "Selfie", "Nature", "City", "Random", "Swag"
            };

            int i = 0;

            if (!orig.Equals("") || !orig.Equals("CATEGORY"))
            {
                i = Array.IndexOf(Categories, orig);
            }

            if (e.Direction.ToString() == "Up")
            {
                if (i < 4)
                {
                    i++;
                }
                String tmp = Categories[i];
                return(tmp);
            }
            else if (e.Direction.ToString() == "Down")
            {
                if (i > 0)
                {
                    i--;
                }
                String tmp = Categories[i];

                return(tmp);
            }
            return(orig);
        }
Example #27
0
 void FlyoutOpen(object sender, SwipedEventArgs e)
 {
     if (!_isFlyoutOpen)
     {
         ToggleFlyout();
     }
 }
        private void SwipeGestureRecognizer_OnSwiped(object sender, SwipedEventArgs e)
        {
            switch (e.Direction)
            {
            case SwipeDirection.Right:
            {
                ChangeChapter(ChapterChangeType.Back);
                break;
            }

            case SwipeDirection.Left:
            {
                ChangeChapter(ChapterChangeType.Next);
                break;
            }

            case SwipeDirection.Up:
                //TODO: settings
                break;

            case SwipeDirection.Down:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
 private async void FinderGoDown(object sender, SwipedEventArgs e)
 {
     if (Finder.TranslationY == 400)
     {
         await Finder.TranslateTo(0, 587.5, 200);
     }
 }
Example #30
0
        private void OnSwipe(object sender, SwipedEventArgs e)
        {
            btnChooseFile.Text = $"Swipe {e.Direction}";
            switch (e.Direction)
            {
            case SwipeDirection.Left:
                // Handle the swipe
                imgMain.Source = ImageSource.FromFile(GlobalVars.gallary.Next().path);
                break;

            case SwipeDirection.Right:
                imgMain.Source = ImageSource.FromFile(GlobalVars.gallary.Next(-1).path);
                // Handle the swipe
                break;

            case SwipeDirection.Up:
                // Handle the swipe
                imgMain.Source = ImageSource.FromFile(GlobalVars.gallary.Next(100).path);
                break;

            case SwipeDirection.Down:
                // Handle the swipe
                imgMain.Source = ImageSource.FromFile(GlobalVars.gallary.SetDelete().path);
                break;
            }
        }