コード例 #1
0
ファイル: MetroInMotion.cs プロジェクト: Makzz90/VKClient_re
        private static Storyboard GetSlideAnimation(FrameworkElement element, bool fromRight)
        {
            double             num1 = fromRight ? 80.0 : -80.0;
            double             num2 = (double)MetroInMotion.GetAnimationLevel((DependencyObject)element) * 0.1 + 0.1;
            TranslateTransform translateTransform = new TranslateTransform()
            {
                X = num1
            };

            element.RenderTransform = (Transform)translateTransform;
            Storyboard storyboard = new Storyboard();
            TimeSpan?  nullable   = new TimeSpan?(TimeSpan.FromSeconds(num2));

            storyboard.BeginTime = nullable;
            storyboard.Children.Add((Timeline)MetroInMotion.CreateAnimation(new double?(num1), new double?(0.0), 0.8, "X", (DependencyObject)translateTransform));
            return(storyboard);
        }
コード例 #2
0
ファイル: MetroInMotion.cs プロジェクト: Makzz90/VKClient_re
        private static Storyboard GetSlideAnimation(FrameworkElement element, bool fromRight)
        {
            double             num1 = fromRight ? 80.0 : -80.0;
            double             num2 = (double)MetroInMotion.GetAnimationLevel((DependencyObject)element) * 0.1 + 0.1;
            TranslateTransform translateTransform1 = new TranslateTransform();
            double             num3 = num1;

            translateTransform1.X = num3;
            TranslateTransform translateTransform2 = translateTransform1;

            ((UIElement)element).RenderTransform = ((Transform)translateTransform2);
            Storyboard storyboard = new Storyboard();
            TimeSpan?  nullable   = new TimeSpan?(TimeSpan.FromSeconds(num2));

            ((Timeline)storyboard).BeginTime = nullable;
            ((PresentationFrameworkCollection <Timeline>)storyboard.Children).Add((Timeline)MetroInMotion.CreateAnimation(new double?(num1), new double?(0.0), 0.8, "X", (DependencyObject)translateTransform2));
            return(storyboard);
        }
コード例 #3
0
ファイル: MetroInMotion.cs プロジェクト: Makzz90/VKClient_re
        private static void OnIsPivotAnimatedChanged(DependencyObject d, DependencyPropertyChangedEventArgs args)
        {
            ItemsControl list = d as ItemsControl;

            list.Loaded += (RoutedEventHandler)((s2, e2) =>
            {
                Pivot pivot = list.Ancestors <Pivot>().Single <DependencyObject>() as Pivot;
                int pivotIndex = pivot.Items.IndexOf((object)list.Ancestors <PivotItem>().Single <DependencyObject>());
                bool selectionChanged = false;
                pivot.SelectionChanged += (SelectionChangedEventHandler)((s3, e3) => selectionChanged = true);
                pivot.ManipulationCompleted += (EventHandler <ManipulationCompletedEventArgs>)((s, e) =>
                {
                    if (!selectionChanged)
                    {
                        return;
                    }
                    selectionChanged = false;
                    if (pivotIndex != pivot.SelectedIndex)
                    {
                        return;
                    }
                    bool fromRight = e.TotalManipulation.Translation.X <= 0.0;
                    List <FrameworkElement> list1 = list.GetItemsInView().ToList <FrameworkElement>();
                    for (int index = 0; index < list1.Count; ++index)
                    {
                        FrameworkElement lbi = list1[index];
                        list.Dispatcher.BeginInvoke((Action)(() =>
                        {
                            foreach (FrameworkElement element in lbi.Descendants().Where <DependencyObject>((Func <DependencyObject, bool>)(p => MetroInMotion.GetAnimationLevel(p) > -1)))
                            {
                                MetroInMotion.GetSlideAnimation(element, fromRight).Begin();
                            }
                        }));
                    }
                });
            });
        }