예제 #1
0
        private void ImageExBase_EffectiveViewportChanged(FrameworkElement sender,
                                                          EffectiveViewportChangedEventArgs args)
        {
            var bringIntoViewDistanceX = args.BringIntoViewDistanceX;
            var bringIntoViewDistanceY = args.BringIntoViewDistanceY;

            var width  = ActualWidth;
            var height = ActualHeight;

            if (bringIntoViewDistanceX <= width && bringIntoViewDistanceY <= height)
            {
                _isInViewport = true;

                if (_lazyLoadingSource != null)
                {
                    var source = _lazyLoadingSource;
                    _lazyLoadingSource = null;
                    SetSource(source);
                }
            }
            else
            {
                _isInViewport = false;
            }
        }
예제 #2
0
 private void ProgressBar_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
 {
     if (sender is ProgressBar progressBar && progressBar.DataContext is ElementModel element)
     {
         SetProgressBarColor(progressBar, element);
     }
 }
예제 #3
0
        private async void Block_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
        {
            //System.Diagnostics.Debug.WriteLine("Bring into view distance: " + (sender.ActualHeight + args.EffectiveViewport.Y) + " item index: " + Presenter.Children.IndexOf(sender));

            if (sender.ActualHeight + args.EffectiveViewport.Y > 100)
            {
                await TranslateTokenAsync(sender as LoadingTextBlock);
            }
        }
예제 #4
0
        private void Grid_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
        {
            if (!_LoadingCalled && args.BringIntoViewDistanceY <= 0)
            {
                _LoadingCalled = true;

                var vm = (DataContext as LiveInfomationPageViewModel);
                vm.InitializeIchibaItems();
                vm.InitializeLiveRecommend();
            }
        }
예제 #5
0
 private async void Grid_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
 {
     if (sender.DataContext != null && (!(sender.DataContext as ListedItem).ItemPropertiesInitialized) && (args.BringIntoViewDistanceX < sender.ActualHeight))
     {
         await Window.Current.CoreWindow.Dispatcher.RunIdleAsync((e) =>
         {
             App.CurrentInstance.ViewModel.LoadExtendedItemProperties(sender.DataContext as ListedItem, 80);
             (sender.DataContext as ListedItem).ItemPropertiesInitialized = true;
         });
     }
 }
예제 #6
0
        private async void Grid_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
        {
            if (sender.DataContext is ListedItem item && (!item.ItemPropertiesInitialized) && (args.BringIntoViewDistanceX < sender.ActualHeight))
            {
                await Window.Current.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                {
                    ParentShellPageInstance.FilesystemViewModel.LoadExtendedItemProperties(item, currentIconSize);
                    item.ItemPropertiesInitialized = true;
                });

                sender.CanDrag = FileList.SelectedItems.Contains(item); // Update CanDrag
            }
        }
예제 #7
0
        private async void Grid_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
        {
            if (sender.DataContext != null && (!(sender.DataContext as ListedItem).ItemPropertiesInitialized) && (args.BringIntoViewDistanceX < sender.ActualHeight))
            {
                await Window.Current.CoreWindow.Dispatcher.RunIdleAsync((e) =>
                {
                    ParentShellPageInstance.FilesystemViewModel.LoadExtendedItemProperties(sender.DataContext as ListedItem, _iconSize);
                    (sender.DataContext as ListedItem).ItemPropertiesInitialized = true;
                });

                (sender as UIElement).CanDrag = FileList.SelectedItems.Contains(sender.DataContext as ListedItem); // Update CanDrag
            }
        }
        private async void Icon_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
        {
            var parentRow = Interacts.Interaction.FindParent <DataGridRow>(sender);

            if ((!(parentRow.DataContext as ListedItem).ItemPropertiesInitialized) && (args.BringIntoViewDistanceX < sender.ActualHeight))
            {
                await Window.Current.CoreWindow.Dispatcher.RunIdleAsync((e) =>
                {
                    App.CurrentInstance.ViewModel.LoadExtendedItemProperties(parentRow.DataContext as ListedItem);
                    (parentRow.DataContext as ListedItem).ItemPropertiesInitialized = true;
                    //sender.EffectiveViewportChanged -= Icon_EffectiveViewportChanged;
                });
            }
        }
예제 #9
0
        private async void Icon_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
        {
            var parentRow = Interacts.Interaction.FindParent <DataGridRow>(sender);

            if (parentRow.DataContext is ListedItem item &&
                !item.ItemPropertiesInitialized &&
                args.BringIntoViewDistanceX < sender.ActualHeight)
            {
                await Window.Current.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                {
                    ParentShellPageInstance.FilesystemViewModel.LoadExtendedItemProperties(parentRow.DataContext as ListedItem);
                    (parentRow.DataContext as ListedItem).ItemPropertiesInitialized = true;
                    //sender.EffectiveViewportChanged -= Icon_EffectiveViewportChanged;
                });
            }
        }
예제 #10
0
 Rect IEffectiveViewportChangedEventArgsResolver.MaxViewport(EffectiveViewportChangedEventArgs e) => e.MaxViewport;
예제 #11
0
        private async void IllustrationThumbnailContainerItem_OnEffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
        {
            var context     = sender.GetDataContext <IllustrationViewModel>();
            var preloadRows = Math.Clamp(App.AppViewModel.AppSetting.PreLoadRows, 1, 15);

            if (args.BringIntoViewDistanceY <= sender.ActualHeight * preloadRows) // [preloadRows] element ahead
            {
                if (await context.LoadThumbnailIfRequired())
                {
                    var transform = (ScaleTransform)sender.RenderTransform;
                    if (sender.IsFullyOrPartiallyVisible(this))
                    {
                        var scaleXAnimation  = transform.CreateDoubleAnimation(nameof(transform.ScaleX), from: 1.1, to: 1, easingFunction: ImageSourceSetEasingFunction, duration: TimeSpan.FromSeconds(2));
                        var scaleYAnimation  = transform.CreateDoubleAnimation(nameof(transform.ScaleY), from: 1.1, to: 1, easingFunction: ImageSourceSetEasingFunction, duration: TimeSpan.FromSeconds(2));
                        var opacityAnimation = sender.CreateDoubleAnimation(nameof(sender.Opacity), from: 0, to: 1, easingFunction: ImageSourceSetEasingFunction, duration: TimeSpan.FromSeconds(2));
                        UIHelper.CreateStoryboard(scaleXAnimation, scaleYAnimation, opacityAnimation).Begin();
                    }
                    else
                    {
                        transform.ScaleX = 1;
                        transform.ScaleY = 1;
                        sender.Opacity   = 1;
                    }
                }

                return;
            }

            // small tricks to reduce memory consumption
            switch (context)
            {
            case { LoadingThumbnail: true } :
예제 #12
0
        private void IllustrationThumbnailContainerItem_OnEffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
        {
            var context = sender.GetDataContext <IllustrationViewModel>();

            if (args.BringIntoViewDistanceY <= sender.ActualHeight) // one element ahead
            {
                _ = context.LoadThumbnailIfRequired();
                return;
            }

            // small tricks to reduce memory consumption
            switch (context)
            {
            case { LoadingThumbnail: true } :
예제 #13
0
 private void UserControl_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
 {
     DistanceX = args.BringIntoViewDistanceX;
     DistanceY = args.BringIntoViewDistanceY;
 }
예제 #14
0
 public static bool NeedsLoading(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
 {
     return(args.BringIntoViewDistanceY < sender.ActualHeight * 1.5 && sender.DataContext != null);
 }
예제 #15
0
 double IEffectiveViewportChangedEventArgsResolver.BringIntoViewDistanceY(EffectiveViewportChangedEventArgs e) => e.BringIntoViewDistanceY;
예제 #16
0
 private void Image_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
 {
 }
예제 #17
0
 private void CarouselRepeater_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
 {
     Viewport = args.MaxViewport;
     HorizontalSnapPointsChanged?.Invoke(this, EventArgs.Empty);
 }
예제 #18
0
 /// <summary>
 /// Gets the sum of translation in the Y-axis that is required to bring the FrameworkElement into view of each viewport containing the element.
 /// </summary>
 /// <param name="e">The requested <see cref="EffectiveViewportChangedEventArgs"/>.</param>
 /// <returns>
 /// The translation in the Y-axis that is required to bring the FrameworkElement into view of each viewport containing the element.
 /// </returns>
 public static double BringIntoViewDistanceY(this EffectiveViewportChangedEventArgs e) => Resolver.BringIntoViewDistanceY(e);
예제 #19
0
 /// <summary>
 /// Gets the Rect representing the maximum effective viewport with the current viewport sizes.
 /// </summary>
 /// <param name="e">The requested <see cref="EffectiveViewportChangedEventArgs"/>.</param>
 /// <returns>The Rect representing the maximum effective viewport with the current viewport sizes.</returns>
 public static Rect MaxViewport(this EffectiveViewportChangedEventArgs e) => Resolver.MaxViewport(e);
예제 #20
0
        private void DropShadowControl_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
        {
            AlbumView album = sender.DataContext as AlbumView;

            if (album == null || album.DontLoad || !ImageHelper.NeedsLoading(sender, args))
            {
                return;
            }
            LoadThumbnail(album);
        }
예제 #21
0
 private async void UserControl_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
 {
     if (sender.DataContext is GridFolderView data && !data.ThumbnailLoaded &&
         ImageHelper.NeedsLoading(sender, args))
     {
         await data.SetThumbnailAsync();
     }
 }