Beispiel #1
0
        private void Caroussel_ItemAppearing(PanCardView.CardsView view, PanCardView.EventArgs.ItemAppearingEventArgs args)
        {
            if (this.ImovelDetail.Imovel.video != null)
            {
                if (this.ImovelDetail.Imovel.video != "")
                {
                    if (view.SelectedItem.ToString().Contains("youtube"))
                    {
                        Videc.Source        = view.SelectedItem.ToString();
                        caroussel.IsVisible = false;


                        Videc.IsVisible = true;
                        box1.IsVisible  = true;
                        box2.IsVisible  = true;
                    }
                    //  VideoC.isVisible = true;
                    // ImagemC.isVisible = false;
                }
            }
            else
            {
                //VideoC.isVisible = false;
                //ImagemC.isVisible = true;
            }
        }
Beispiel #2
0
        private void CarouseView_ItemSwiped(PanCardView.CardsView view, PanCardView.EventArgs.ItemSwipedEventArgs args)
        {
            int currentIndex = 0;

            if (args.Direction == PanCardView.Enums.ItemSwipeDirection.Right)
            {
                currentIndex = carouseView.SelectedIndex - 1;
            }
            else if (args.Direction == PanCardView.Enums.ItemSwipeDirection.Left)
            {
                currentIndex = carouseView.SelectedIndex + 1;
            }

            int next_index = (currentIndex + 1);

            if (next_index > viewModel.ImageSlideCount)
            {
                next_index = 1;
            }
            else if (next_index < 1)
            {
                next_index = viewModel.ImageSlideCount;
            }
            viewModel.CurrentSlideImageIndex = next_index;
        }
Beispiel #3
0
 private void Caroussel_ItemSwiped(PanCardView.CardsView view, PanCardView.EventArgs.ItemSwipedEventArgs args)
 {
     /*    if (this.ImovelDetail.Imovel.video != null)
      *  {
      *      if (this.ImovelDetail.Imovel.video != "")
      *      {
      *          if (view.SelectedItem.ToString().Contains("youtube"))
      *          {
      *              Videc.Source = view.SelectedItem.ToString();
      *              caroussel.IsVisible = false;
      *
      *
      *              Videc.IsVisible = true;
      *              box1.IsVisible = true;
      *              box2.IsVisible = true;
      *
      *
      *
      *
      *          }
      *        //  VideoC.isVisible = true;
      *         // ImagemC.isVisible = false;
      *      }
      *  }
      *  else
      *  {
      *      //VideoC.isVisible = false;
      *      //ImagemC.isVisible = true;
      *  }*/
 }
Beispiel #4
0
 private void CarouselView_UserInteracted(PanCardView.CardsView view, PanCardView.EventArgs.UserInteractedEventArgs args)
 {
     if (args.Status == PanCardView.Enums.UserInteractionStatus.Started)
     {
         MainPage.DisableSwipe();
     }
 }
Beispiel #5
0
        private async void ItemAppeared(PanCardView.CardsView view, PanCardView.EventArgs.ItemAppearedEventArgs args)
        {
            if (view.SelectedIndex == 1)
            {
                await RootScrollView.ScrollToAsync(EmptyLayout, ScrollToPosition.Start, true);

                view.ForceLayout();
            }
        }
Beispiel #6
0
        private void MainCardView_UserInteracted(PanCardView.CardsView view,
                                                 PanCardView.EventArgs.UserInteractedEventArgs args)
        {
            var card = MainCardView.CurrentView as HeroCard;


            if (args.Status == PanCardView.Enums.UserInteractionStatus.Running)
            {
                // work out what percent the swipe is at
                var percentFromCenter = Math.Abs(args.Diff / this.Width);
                Debug.WriteLine($"Percent {percentFromCenter}");

                var opacity = (1 - (percentFromCenter)) * 1.5;
                if (opacity > 1)
                {
                    opacity = 1;
                }

                MainCardView.CurrentView.Opacity = opacity;

                // do the scaling on the main card during swipe
                var scale = (1 - (percentFromCenter) * 1.5);
                if (scale > 1)
                {
                    scale = 1;
                }
                card.MainImage.Scale = scale;

                var imageBaseMargin = -150;
                var movementFactor  = 100;

                var translation = imageBaseMargin + (movementFactor * percentFromCenter);
                card.MainImage.TranslationY = translation;

                // adjust opacity of image
                card.MainImage.Opacity = opacity;
                var nextCard = MainCardView.CurrentBackViews.First() as HeroCard;

                // adjust opacity of the back image
                nextCard.MainImage.Opacity = LimitToRange(percentFromCenter * 1.5, 0, 1);
                nextCard.MainImage.Scale   = LimitToRange(percentFromCenter * 1.5, 0, 1);

                // percent => 0, 0
                // percent => .5 => -75
                // percent => 1, -150
                nextCard.MainImage.TranslationY = LimitToRange((imageBaseMargin * percentFromCenter) * 1.5, -150, 0);
            }

            if (args.Status == PanCardView.Enums.UserInteractionStatus.Ended ||
                args.Status == PanCardView.Enums.UserInteractionStatus.Ending)
            {
                card.Opacity                = 1;
                card.MainImage.Scale        = 1;
                card.MainImage.TranslationY = -150;
                card.MainImage.Opacity      = 1;
            }
        }
Beispiel #7
0
 private async void OnCoverFlowViewItemAppeared(PanCardView.CardsView view, PanCardView.EventArgs.ItemAppearedEventArgs args)
 {
     if (view.SelectedIndex != 0)
     {
         var frame       = view.CurrentView as Frame;
         var stackLayout = frame.Children[0] as StackLayout;
         await stackLayout.Children[0].ScaleTo(1.1, 200, Easing.CubicInOut);
         await stackLayout.Children[0].ScaleTo(1, 500, Easing.CubicIn);
     }
 }
Beispiel #8
0
        private void Caroussel_ItemAppearing(PanCardView.CardsView view, PanCardView.EventArgs.ItemAppearingEventArgs args)
        {
            Imovel imovel = args.Item as Imovel;

            if (imovel != null)
            {
                Mapa.MoveToRegion(MapSpan.FromCenterAndRadius(
                                      new Position(imovel.localizacao.Latitude, imovel.localizacao.Longitude),
                                      Distance.FromMiles(0.5)));
            }
        }
 private void _coverFlow_UserInteracted(PanCardView.CardsView view, PanCardView.EventArgs.UserInteractedEventArgs args)
 {
     if (args.Status == PanCardView.Enums.UserInteractionStatus.Started)
     {
         FootballMatchesTabPage.DisableSwipe();
     }
     if (args.Status == PanCardView.Enums.UserInteractionStatus.Ended)
     {
         FootballMatchesTabPage.EnableSwipe();
     }
 }
 private async void CoverFlowView_UserInteractedAsync(PanCardView.CardsView view, PanCardView.EventArgs.UserInteractedEventArgs args)
 {
     if (args.Status == PanCardView.Enums.UserInteractionStatus.Started)
     {
         await playNeedleAnimationManager.RunAnimationAsync(Models.ENUM.PlayNeedleRunMode.up);
     }
     else if (args.Status == PanCardView.Enums.UserInteractionStatus.Ended)
     {
         await playNeedleAnimationManager.RunAnimationAsync(Models.ENUM.PlayNeedleRunMode.down);
     }
 }
        public PracticeViewerModel(PanCardView.CardsView view, Dictionary <int, byte[]> imageFiles, int index)
        {
            this.imageFiles = imageFiles;
            ImageCount      = imageFiles.Count;
            CurrentIndex    = index;
            _nextIndex      = index + 1;
            PrevContext     = _nextIndex >= ImageCount ? null : CreateContext(_nextIndex);
            CurrentContext  = CreateContext(_currentIndex);
            NextContext     = _nextIndex >= ImageCount ? null : CreateContext(_nextIndex);
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentIndex)));

            PanStartedCommand = new Command(() =>
            {
                if (_nextIndex < ImageCount && PrevContext == null)
                {
                    PrevContext = CreateContext(_nextIndex);
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PrevContext)));
                }
                if (_nextIndex < ImageCount && NextContext == null)
                {
                    NextContext = CreateContext(_nextIndex);
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(NextContext)));
                }
            });

            PanPositionChangedCommand = new Command((p) =>
            {
                var isNext = (bool)p;
                if (isNext)
                {
                    CurrentIndex += 1;
                    _nextIndex++;
                    PrevContext    = _nextIndex >= ImageCount ? null : CreateContext(_nextIndex);
                    CurrentContext = NextContext;
                    NextContext    = _nextIndex >= ImageCount ? null : CreateContext(_nextIndex);
                }
                else
                {
                    CurrentIndex += 1;
                    ++_nextIndex;
                    NextContext    = _nextIndex >= ImageCount ? null : CreateContext(_nextIndex);
                    CurrentContext = PrevContext;
                    PrevContext    = _nextIndex >= ImageCount ? null : CreateContext(_nextIndex);
                }
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(NextContext)));
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PrevContext)));
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentContext)));
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentIndex)));
            });
        }
Beispiel #12
0
        private void CarouselView_ItemAppeared(PanCardView.CardsView view, PanCardView.EventArgs.ItemAppearedEventArgs args)
        {
            if (args.Index == 0)
            {
                unitsLabel.Text = "kW";
            }
            else if (args.Index == 1)
            {
                unitsLabel.Text = "kWh";
            }

            if (args.Type == PanCardView.Enums.InteractionType.User)
            {
                lastManualSwipe = DateTime.Now;
                ShowSettingsButtonThenFade();
            }
        }
        private void MainCardView_UserInteracted(
            PanCardView.CardsView view,
            PanCardView.EventArgs.UserInteractedEventArgs args)
        {
            var card = MainCardView.CurrentView as PokemonCardView;

            if (args.Status == PanCardView.Enums.UserInteractionStatus.Running)
            {
                var ratioFromCenter = Math.Abs(args.Diff / this.Width);

                animateFirstCard(card, ratioFromCenter);


                var nextCard = MainCardView.CurrentBackViews.First() as PokemonCardView;

                animateSecondCard(nextCard, ratioFromCenter);
            }

            //Reset parameters of the card after swipe so it doens't look stupid
            if (args.Status == PanCardView.Enums.UserInteractionStatus.Ending)
            {
                card.MainImage.FadeTo(1, 250);
                card.MainImage.ScaleTo(1, 250);
                card.MainImage.TranslateTo(this.X, 0, 250);
                card.ScaleTo(1, 50);
            }


            if (args.Status == PanCardView.Enums.UserInteractionStatus.Ended)
            {
                if (MainCardView.CurrentBackViews.Count() == 0)
                {
                    return;
                }
                var prevCard = MainCardView.CurrentBackViews.First() as PokemonCardView;
                prevCard.MainImage.TranslationY = 0;
            }
        }
Beispiel #14
0
        private void MainCardView_UserInteracted(
            PanCardView.CardsView view,
            PanCardView.EventArgs.UserInteractedEventArgs args)
        {
            if (args.Status == PanCardView.Enums.UserInteractionStatus.Running)
            {
                // get the front card
                var card = MainCardView.CurrentView as HeroCard;

                // work out what percent the swipe is at
                var percentFromCenter = Math.Abs(args.Diff / this.Width);

                // adjust scale when panning
                if ((percentFromCenter > 0) && (card.Scale == 1))
                {
                    card.ScaleTo(.95, 50);
                }

                // update elements based on swipe position
                AnimateFrontCardDuringSwipe(card, percentFromCenter);

                // get the next card on the stack, which is the one coming into view
                var nextCard = MainCardView.CurrentBackViews.First() as HeroCard;

                // update elements based on swipe position
                AnimateIncomingCardDuringSwipe(nextCard, percentFromCenter);
            }

            if (args.Status == PanCardView.Enums.UserInteractionStatus.Ended ||
                args.Status == PanCardView.Enums.UserInteractionStatus.Ending)
            {
                // at the end of dragging we need to make sure card is reset
                var card = MainCardView.CurrentView as HeroCard;
                AnimateFrontCardDuringSwipe(card, 0);
                card.ScaleTo(1, 50);
            }
        }
Beispiel #15
0
 private void CarouselView_ItemAppearing(PanCardView.CardsView view, PanCardView.EventArgs.ItemAppearingEventArgs args)
 {
 }
Beispiel #16
0
 private void Tabs_ItemAppearing(PanCardView.CardsView view, PanCardView.EventArgs.ItemAppearingEventArgs args)
 {
     SelectTab(tabs.SelectedIndex);
 }
Beispiel #17
0
        private void MainCardView_UserInteracted(PanCardView.CardsView view,
                                                 PanCardView.EventArgs.UserInteractedEventArgs args)
        {
            var card     = MainCardView.CurrentView as HeroCard;
            var nextCard = MainCardView.CurrentBackViews.FirstOrDefault() as HeroCard;

            var percentFromCenter = Math.Abs(args.Diff / this.Width);

            Debug.WriteLine($"% from C: {card.MainImage.Source.ToString()} {args.Status} {percentFromCenter}");

            if (args.Status == PanCardView.Enums.UserInteractionStatus.Started)
            {
                if (nextCard != null && false)
                {
                    nextCard.Opacity                = 1;
                    nextCard.MainImage.Scale        = 1;
                    nextCard.MainImage.TranslationY = _defaultTranslationY;
                }
            }

            if (args.Status == PanCardView.Enums.UserInteractionStatus.Running)
            {
                // control opacity of currnet card
                var opacity = 1 - (percentFromCenter * 0.8);
                card.Opacity = (opacity > 1) ? 1 : opacity;

                // set scale of image in current card
                card.MainImage.Scale = Math.Max(1 - (percentFromCenter * 1.5), .5);

                // set position of image in current card
                var movementFactor = 150;
                card.MainImage.TranslationY = _defaultTranslationY + (movementFactor * percentFromCenter);

                // set opacity of next card
                nextCard.MainImage.Opacity = 1 - (opacity / 4);
                nextCard.MainImage.Scale   = Math.Min(percentFromCenter * 3, 1);

                // set margin
                var lrMargin = Math.Min(10, 50 * percentFromCenter);

                // add margin
                card.ScaleTo(.9, 50);
            }

            if (args.Status == PanCardView.Enums.UserInteractionStatus.Ended ||
                args.Status == PanCardView.Enums.UserInteractionStatus.Ending)
            {
                card.Opacity                = 1;
                card.MainImage.Opacity      = 1;
                card.MainImage.Scale        = 1;
                card.MainImage.TranslationY = _defaultTranslationY;

                // ensure next card is hidden
                nextCard.MainImage.Opacity      = 0;
                nextCard.MainImage.Scale        = 1;
                nextCard.MainImage.TranslationY = _defaultTranslationY;

                // remove margin
                card.ScaleTo(1, 50);
            }
        }