Ejemplo n.º 1
0
        private void MainGr_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (e.IsInertial && !_isSwiped)
            {
                var swipedDistance = e.Cumulative.Translation.Y;

                if (Math.Abs(swipedDistance) <= 2)
                {
                    return;
                }
                _isSwiped = true;
                if (swipedDistance > 0)
                {
                    //SwipeableTextBlock.Text = "Down Swiped";
                }
                else
                {
                    CarouVideo.Pause();
                    StoryViews.PauseStartTimer(true);
                    if (CarouselItem.User.UserName == AppCore.InstaApi.GetLoggedUser().UserName)
                    {
                        EditFr.Navigate(typeof(StoryViewersView), CarouselItem.Id);
                    }
                    //SwipeableTextBlock.Text = "Up Swiped";
                }
            }
        }
Ejemplo n.º 2
0
        private async void Media_Tapped(object sender, TappedRoutedEventArgs e)
        {
            _tapscount++;
            await Task.Delay(350);

            if (_tapscount == 0)
            {
                return;
            }
            if (_tapscount == 1)
            {
                if (CarouVideo.Source != null)
                {
                    if (CarouVideo.CurrentState == MediaElementState.Playing)
                    {
                        CarouVideo.Pause();
                    }
                    else
                    {
                        CarouVideo.Play();
                    }
                }
            }
            _tapscount = 0;
        }
Ejemplo n.º 3
0
 private void CarouselItemUCStories_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "Play")
     {
         var value = DataContext as InstaStoryItem;
         if (value.Play)
         {
             CarouVideo.Play();
         }
         else
         {
             CarouVideo.Stop();
         }
     }
 }
Ejemplo n.º 4
0
        private async void CarouselItemUC_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
        {
            if (args.NewValue == null)
            {
                return;
            }

            if (args.NewValue.GetType() == typeof(InstaStoryItem))
            {
                var value = DataContext as InstaStoryItem;
                value.PropertyChanged += CarouselItemUCStories_PropertyChanged;
                var DPI = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().LogicalDpi;

                var   bounds      = Window.Current.Bounds;
                float scaleHeight = (float)bounds.Height / (float)value.OriginalHeight;
                float scaleWidth  = (float)bounds.Width / (float)value.OriginalWidth;

                float scale = Math.Min(scaleHeight, scaleWidth);

                if (value.MediaType == 1)
                {
                    CarouVideo.Visibility = Visibility.Collapsed;
                    CarouImage.Visibility = Visibility.Visible;
                    CarouImage.Source     = new BitmapImage(new Uri(value.ImageList.FirstOrDefault().URI, UriKind.RelativeOrAbsolute));

                    var ActualWidth  = bounds.Width * value.OriginalWidth;
                    var ActualHeight = bounds.Height * value.OriginalHeight;

                    CarouImage.Height = AlignGrid.Height = (int)(value.OriginalHeight * scale);
                    CarouImage.Width  = AlignGrid.Width = (int)(value.OriginalWidth * scale);
                    CalcLocationOfMention();
                    CalcLocationOfHashTags();
                    CalcLocationOfLocations();
                }

                else
                {
                    CarouImage.Visibility   = Visibility.Collapsed;
                    CarouVideo.Visibility   = Visibility.Visible;
                    CarouVideo.PosterSource = new BitmapImage(new Uri(value.ImageList.FirstOrDefault().URI, UriKind.RelativeOrAbsolute));
                    CarouVideo.Source       = new Uri(value.VideoList.FirstOrDefault().Url, UriKind.RelativeOrAbsolute);

                    var ActualWidth  = bounds.Width * value.OriginalWidth;
                    var ActualHeight = bounds.Height * value.OriginalHeight;

                    CarouVideo.Height = AlignGrid.Height = (int)(value.OriginalHeight * scale);
                    CarouVideo.Width  = AlignGrid.Width = (int)(value.OriginalWidth * scale);
                    CalcLocationOfMention();
                    CalcLocationOfHashTags();
                    CalcLocationOfLocations();
                }

                if (value.StoryCTA != null)
                {
                    SeeMoreGrid.Visibility = Visibility.Visible;
                    if (value.LinkText != null)
                    {
                        AdLinkText.Text = value.LinkText;
                    }
                }
            }
            CarouVideo.Stop();

            //var a = await AppCore.InstaApi.StoryProcessor.GetStoryMediaViewers(CarouselItem.Id, PaginationParameters.MaxPagesToLoad(1));
        }
Ejemplo n.º 5
0
 private void AlignGrid_PointerReleased(object sender, PointerRoutedEventArgs e)
 {
     CarouVideo.Play();
     StoryViews.PauseStartTimer(false);
 }
Ejemplo n.º 6
0
 private void AlignGrid_PointerPressed(object sender, PointerRoutedEventArgs e)
 {
     CarouVideo.Pause();
     StoryViews.PauseStartTimer(true);
 }