Exemplo n.º 1
0
        /**
         * This class is intended to hold templates for any animations that need
         * to be created.
         * This was first created to allow easy creation of storyboards to be able
         * to highlight the board to show the ranks and files of the board seperately.
         */
        /// <summary>
        /// Highlights a square with a given colour. The square flashes this given colour
        /// </summary>
        public static Storyboard NewHighlighter(Square s, Brush brush, int delay)
        {
            int beginFadeIn = 0;
            int beginFadeOut = beginFadeIn + 300;

            Duration duration = new Duration(TimeSpan.FromMilliseconds(200));

            ColorAnimation fadeIn = new ColorAnimation()
            {
                From = ((SolidColorBrush)(s.rectangle.Fill)).Color,
                To = (brush as SolidColorBrush).Color,
                Duration = duration,
                BeginTime = TimeSpan.FromMilliseconds(beginFadeIn)
            };

            ColorAnimation fadeOut = new ColorAnimation()
            {
                From = (brush as SolidColorBrush).Color,
                To = (s.rectangle.Fill as SolidColorBrush).Color,
                Duration = duration,
                BeginTime = TimeSpan.FromMilliseconds(beginFadeOut)
            };

            Storyboard.SetTarget(fadeIn, s.rectangle);
            Storyboard.SetTargetProperty(fadeIn, new PropertyPath("Fill.Color"));
            Storyboard.SetTarget(fadeOut, s.rectangle);
            Storyboard.SetTargetProperty(fadeOut, new PropertyPath("Fill.Color"));

            Storyboard highlight = new Storyboard();
            highlight.Children.Add(fadeIn);
            highlight.Children.Add(fadeOut);

            return highlight;
        }
Exemplo n.º 2
0
 public PictureController()
 {
     slideShowTimer = new DispatcherTimer();
     Duration = new Duration(TimeSpan.FromSeconds(5));
     slideShowTimer.Interval = Duration.TimeSpan;
     slideShowTimer.Tick += new EventHandler(slideShowTimer_Tick);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Advances the clock by the given duration.
 /// </summary>
 /// <param name="duration">The duration to advance the clock by (or if negative, the duration to move it back
 /// by).</param>
 public void Advance(Duration duration)
 {
     lock (mutex)
     {
         now += duration;
     }
 }
 public DoubleAnimation(double from, double to, Duration duration, FillBehavior fillBehavior)
 {
   this.From = from;
   this.To = to;
   this.Duration = duration;
   this.FillBehavior = fillBehavior;
 }
 public ExpoEasingDoubleAnimation(double from, double to, EasingMode easeInMethod, Duration duration)
 {
     FromValue = from;
     ToValue = to;
     Duration = duration;
     EaseFunction = easeInMethod;
 }
        public override bool Load(ConfigNode configNode)
        {
            // Load base class
            bool valid = base.Load(configNode);

            valid &= ConfigNodeUtil.ParseValue<Vessel.Situations>(configNode, "situation", x => situation = x, this, Vessel.Situations.ORBITING, ValidateSituations);
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "minAltitude", x => minAltitude = x, this, 0.0, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "maxAltitude", x => maxAltitude = x, this, double.MaxValue, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "minApA", x => minApoapsis = x, this, 0.0, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "maxApA", x => maxApoapsis = x, this, double.MaxValue, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "minPeA", x => minPeriapsis = x, this, 0.0, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "maxPeA", x => maxPeriapsis = x, this, double.MaxValue, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "minEccentricity", x => minEccentricity = x, this, 0.0, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "maxEccentricity", x => maxEccentricity = x, this, double.MaxValue, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "minInclination", x => minInclination = x, this, 0.0, x => Validation.Between(x, 0.0, 180.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "maxInclination", x => maxInclination = x, this, 180.0, x => Validation.Between(x, 0.0, 180.0));
            valid &= ConfigNodeUtil.ParseValue<Duration>(configNode, "minPeriod", x => minPeriod = x, this, new Duration(0.0));
            valid &= ConfigNodeUtil.ParseValue<Duration>(configNode, "maxPeriod", x => maxPeriod = x, this, new Duration(double.MaxValue));

            // Validate target body
            valid &= ValidateTargetBody(configNode);

            // Validation minimum and groupings
            valid &= ConfigNodeUtil.AtLeastOne(configNode, new string[] { "minAltitude", "maxAltitude", "minApA", "maxApA", "minPeA", "maxPeA",
                "minEccentricity", "maxEccentricity", "minInclination", "maxInclination", "minPeriod", "maxPeriod" }, this);
            valid &= ConfigNodeUtil.MutuallyExclusive(configNode, new string[] { "minAltitude", "maxAltitude" },
                new string[] { "minApA", "maxApA", "minPeA", "maxPeA" }, this);

            return valid;
        }
Exemplo n.º 7
0
        private void PerformCaptureAnimation()
        {
            LoadingView.Text = "Processing ...";
            ShowLoadingView();

            curtain = new Rectangle();
            curtain.Fill = new SolidColorBrush(Colors.White);
            LayoutRoot.Children.Add(curtain);

            Storyboard animation = new Storyboard();
            Duration duration = new Duration(TimeSpan.FromSeconds(0.3));
            animation.Duration = duration;

            DoubleAnimation curtainAnimation = new DoubleAnimation();
            animation.Children.Add(curtainAnimation);
            curtainAnimation.Duration = duration;
            curtainAnimation.To = 0;
            curtainAnimation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseIn };
            Storyboard.SetTarget(curtainAnimation, curtain);
            Storyboard.SetTargetProperty(curtainAnimation, new PropertyPath("Opacity"));

            animation.Completed += (sender, e) => {
                LayoutRoot.Children.Remove(curtain);
            };

            animation.Begin();
        }
Exemplo n.º 8
0
        private void AnimateEntry(Size targetSize)
        {
            var svi = GuiHelpers.GetParentObject<ScatterViewItem>(this, false);
            if (svi != null)
            {
                // Easing function provide a more natural animation
                IEasingFunction ease = new BackEase {EasingMode = EasingMode.EaseOut, Amplitude = 0.3};
                var duration = new Duration(TimeSpan.FromMilliseconds(500));
                var w = new DoubleAnimation(0.0, targetSize.Width, duration) {EasingFunction = ease};
                var h = new DoubleAnimation(0.0, targetSize.Height, duration) {EasingFunction = ease};
                var o = new DoubleAnimation(0.0, 1.0, duration);

                // Remove the animation after it has completed so that its possible to manually resize the scatterviewitem
                w.Completed += (s, e) => svi.BeginAnimation(ScatterViewItem.WidthProperty, null);
                h.Completed += (s, e) => svi.BeginAnimation(ScatterViewItem.HeightProperty, null);
                // Set the size manually, otherwise once the animation is removed the size will revert back to the minimum size
                // Since animation has higher priority for DP's, this setting won't have effect until the animation is removed
                svi.Width = targetSize.Width;
                svi.Height = targetSize.Height;

                svi.BeginAnimation(ScatterViewItem.WidthProperty, w);
                svi.BeginAnimation(ScatterViewItem.HeightProperty, h);
                svi.BeginAnimation(ScatterViewItem.OpacityProperty, o);
            }
        }
Exemplo n.º 9
0
		public static bool Equals (Duration t1, Duration t2)
		{
			if (t1.kind == DurationKind.TimeSpan && t2.kind == DurationKind.TimeSpan)
				return t1.time_span == t2.time_span;

			return t1.kind == t2.kind;
		}
Exemplo n.º 10
0
        public void DismissEVHUD()
        {
            if (evHUDView == null)
            {
                return;
            }

            Storyboard storyboard = new Storyboard();
            Duration duration = new Duration(TimeSpan.FromSeconds(0.3));
            storyboard.Duration = duration;

            DoubleAnimation panelAnimation = new DoubleAnimation();
            panelAnimation.Duration = duration;
            panelAnimation.To = evHUDView.Width;
            panelAnimation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut };
            Storyboard.SetTarget(panelAnimation, evHUDView);
            Storyboard.SetTargetProperty(panelAnimation, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.X)"));
            storyboard.Children.Add(panelAnimation);

            storyboard.Begin();
            storyboard.Completed += (sender, e) =>
            {
                evHUDView.Visibility = Visibility.Collapsed;

                if (Orientation == PageOrientation.LandscapeLeft || Orientation == PageOrientation.LandscapeRight)
                {
                    ShowLandscapeShutterButton();
                }

            };
        }
Exemplo n.º 11
0
 public PennerDoubleAnimation(Equations type, double from, double to, Duration duration)
 {
     Equation = type;
     From = from;
     To = to;
     Duration = duration;
 }
Exemplo n.º 12
0
 private void Discard(ListBox menu)
 {
     menu.IsEnabled = false;
     var duration = new Duration(TimeSpan.FromMilliseconds(400));
     DoubleAnimation
         posXAnimation = new DoubleAnimation { Duration = duration, To = -80 },
         posYAnimation = new DoubleAnimation { Duration = duration, To = -80 },
         scaleXAnimation = new DoubleAnimation { Duration = duration, To = 1.5 },
         scaleYAnimation = new DoubleAnimation { Duration = duration, To = 1.5 },
         opacityAnimation = new DoubleAnimation { Duration = duration, To = 0 }
     ;
     var translateTransform = ((TransformGroup)menu.RenderTransform).Children[0];
     var scaleTransform = ((TransformGroup)menu.RenderTransform).Children[1];
     translateTransform.BeginAnimation(TranslateTransform.XProperty, posXAnimation);
     translateTransform.BeginAnimation(TranslateTransform.YProperty, posYAnimation);
     scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleXAnimation);
     scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleYAnimation);
     opacityAnimation.Completed += (object sender, EventArgs e) =>
     {
         menu.Visibility = Visibility.Collapsed;
         menu.IsEnabled = true;
         translateTransform.BeginAnimation(TranslateTransform.XProperty, null);
         translateTransform.BeginAnimation(TranslateTransform.YProperty, null);
         scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, null);
         scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, null);
         menu.BeginAnimation(OpacityProperty, null);
     };
     menu.BeginAnimation(OpacityProperty, opacityAnimation);
 }
Exemplo n.º 13
0
        static public void AnimateOpacity(FrameworkElement element, double start, double end, double duration)
        {
            element.Opacity = 0;

            Duration animationDuration = new Duration(TimeSpan.FromSeconds(duration));
            DoubleAnimation opacityAnimation = new DoubleAnimation();

            opacityAnimation.Duration = animationDuration;
            opacityAnimation.From = start;
            opacityAnimation.To = end;

            Storyboard sb = new Storyboard();
            sb.Duration = animationDuration;

            sb.Children.Add(opacityAnimation);

            Storyboard.SetTarget(opacityAnimation, element);

            // Set the X and Y properties of the Transform to be the target properties
            // of the two respective DoubleAnimations.
            Storyboard.SetTargetProperty(opacityAnimation, "Opacity");

            // Begin the animation.
            sb.Begin();
        }
Exemplo n.º 14
0
        /// <summary>
        /// Animates specified property of the object.
        /// </summary>
        /// <param name="target">The target object to animate.</param>
        /// <param name="propertyPath">Property path, e.g. Canvas.Top.</param>
        /// <param name="from">Animation's starting value.</param>
        /// <param name="to">Animation's ending value.</param>
        /// <param name="milliseconds">Duration of the animation in milliseconds.</param>
        /// <param name="easingFunction">Easing function applied to the animation.</param>
        /// <param name="completed">Event handler called when animation completed.</param>
        /// <returns>Returns started storyboard.</returns>
        public static Storyboard AnimateDoubleProperty(this DependencyObject target, string propertyPath, double? from, double? to, double milliseconds,
            IEasingFunction easingFunction = null, EventHandler completed = null)
        {
            Duration duration = new Duration(TimeSpan.FromMilliseconds(milliseconds));
            DoubleAnimation doubleAnimation = new DoubleAnimation()
            {
                From = from,
                To = to,
                Duration = duration,
                EasingFunction = easingFunction
            };

            Storyboard storyboard = new Storyboard();
            storyboard.Duration = duration;
            storyboard.Children.Add(doubleAnimation);

            Storyboard.SetTarget(doubleAnimation, target);
            Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath(propertyPath));

            if (completed != null)
                storyboard.Completed += completed;

            storyboard.Begin();

            return storyboard;
        }
Exemplo n.º 15
0
        /// <summary>
        /// Animates the translate transform object, responsible for displacement of the target.
        /// </summary>
        /// <param name="target">The target object.</param>
        /// <param name="storyboard">The storyboard.</param>
        /// <param name="to">Animation's ending value.</param>
        /// <param name="seconds">Duration of the animation in seconds.</param>
        /// <param name="easingFunction">Easing function applied to the animation.</param>
        public static void AnimateTranslateTransform(this DependencyObject target, Storyboard storyboard, Point to,
            double seconds, IEasingFunction easingFunction = null)
        {
            Duration duration = new Duration(TimeSpan.FromSeconds(seconds));

            DoubleAnimation doubleAnimationX = new DoubleAnimation()
            {
                To = to.X,
                Duration = duration,
                EasingFunction = easingFunction
            };

            DoubleAnimation doubleAnimationY = new DoubleAnimation()
            {
                To = to.Y,
                Duration = duration,
                EasingFunction = easingFunction
            };

            storyboard.Stop();
            storyboard.Children.Clear();
            storyboard.Duration = duration;
            storyboard.Children.Add(doubleAnimationX);
            storyboard.Children.Add(doubleAnimationY);

            Storyboard.SetTarget(doubleAnimationX, target);
            Storyboard.SetTarget(doubleAnimationY, target);
            Storyboard.SetTargetProperty(doubleAnimationX, (target as UIElement).GetPropertyPathForTranslateTransformX());
            Storyboard.SetTargetProperty(doubleAnimationY, (target as UIElement).GetPropertyPathForTranslateTransformY());

            storyboard.Begin();
        }
Exemplo n.º 16
0
        public Duration getUnionDuration(Duration duration)
        {
            DateTime start = (this.startDate <= duration.getStartDate()) ? this.startDate : duration.getStartDate();
            DateTime end = this.endDate >= duration.getEndDate() ? this.endDate : duration.getEndDate();

            return new Duration(start, end);
        }
Exemplo n.º 17
0
 /// <summary>
 /// Set Properties
 /// </summary>
 /// <param name="from">Start Point</param>
 /// <param name="to">End Point</param>
 /// <param name="easeInMethod">Easing method equation</param>
 /// <param name="duration">Duration for the animation</param>
 public QuadPointEasingAnimation(Point from, Point to, PointEasingMode easeInMethod, Duration duration)
 {
     FromValue = from;
     ToValue = to;
     Duration = duration;
     EaseFunction = easeInMethod;
 }
Exemplo n.º 18
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="AnimatedLoader" /> class.
        /// </summary>
        public AnimatedLoader()
        {
            Visibility = Visibility.Hidden;
            IsVisibleChanged += LoaderVisibilityChanged;

            var imageSource = Application.Current.Resources["LoaderImage"] as ImageSource;
            var loaderUri = imageSource == null
                                ? new Uri("pack://application:,,,/Nova;component/Resources/loader.gif", UriKind.Absolute)
                                : new Uri(imageSource.ToString(), UriKind.Absolute);

            _gifBitmapDecoder = new GifBitmapDecoder(loaderUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);

            var seconds = _gifBitmapDecoder.Frames.Count/10;
            var milliseconds = (int) (((_gifBitmapDecoder.Frames.Count/10.0) - (_gifBitmapDecoder.Frames.Count/10.0))*1000d);

            var timespan = new TimeSpan(0, 0, 0, seconds, milliseconds);
            var duration = new Duration(timespan);

            _animation = new Int32Animation(0, _gifBitmapDecoder.Frames.Count - 1, duration)
                {
                    RepeatBehavior = RepeatBehavior.Forever
                };

            Source = _gifBitmapDecoder.Frames[0];
            Height = Source.Height;
            Width = Source.Width;
        }
Exemplo n.º 19
0
        private void MakeFive(object sender, RoutedEventArgs e)
        {
            sbar.Items.Clear();
            TextBlock txtb = new TextBlock();
            txtb.Text = "ProgressBar";
            sbar.Items.Add(txtb);
            Button btn = new Button();
            btn.Height = 50;
            btn.Width = 50;
            Image image = new Image();
            BitmapImage bi = new BitmapImage();
            bi.BeginInit();
            bi.UriSource = new Uri(@"pack://application:,,,/data/cat.png");
            bi.EndInit();
            image.Source = bi;
            ImageBrush imagebrush = new ImageBrush(bi);
            btn.Background = imagebrush;

            ProgressBar progbar = new ProgressBar();
            progbar.Background = imagebrush;
            progbar.Width = 150;
            progbar.Height = 15;
            Duration duration = new Duration(TimeSpan.FromMilliseconds(2000));
            DoubleAnimation doubleanimation = new DoubleAnimation(100.0, duration);
            doubleanimation.RepeatBehavior = new RepeatBehavior(5);
            progbar.BeginAnimation(ProgressBar.ValueProperty, doubleanimation);
            btn.Content = progbar;
            sbar.Items.Add(btn);
         }
Exemplo n.º 20
0
 public Period(Date_Time start, Date_Time end)
     : this()
 {
     StartTime = start;
     EndTime = end;
     Duration = new Duration(end.Value - start.Value);
 }
Exemplo n.º 21
0
 public Period(Date_Time start, TimeSpan duration)
     : this()
 {
     StartTime = start;
     Duration = new Duration(duration);            
     EndTime = start + duration;
 }
Exemplo n.º 22
0
        public override void PerformTranstition(UserControl newPage, UserControl oldPage)
        {
            this.newPage = newPage;
            this.oldPage = oldPage;

            Duration duration = new Duration(TimeSpan.FromSeconds(1));

            DoubleAnimation animation = new DoubleAnimation();
            animation.Duration = duration;
            switch (direction)
            {
                case WipeDirection.LeftToRight:
                    animation.To = oldPage.ActualWidth;
                    break;
                case WipeDirection.RightToLeft:
                    animation.To = -oldPage.ActualWidth;
                    break;
            }

            Storyboard sb = new Storyboard();
            sb.Duration = duration;
            sb.Children.Add(animation);
            sb.Completed += sb_Completed;

            TranslateTransform sc = new TranslateTransform();
            oldPage.RenderTransform = sc;

            Storyboard.SetTarget(animation, sc);
            Storyboard.SetTargetProperty(animation, new PropertyPath("X"));

            //oldPage.Resources.Add(sb);

            sb.Begin();
        }
Exemplo n.º 23
0
 public Entry(DateTime date, double duration, string activity, string note)
 {
     Date = date;
     Activity = activity;
     Duration = new Duration(duration);
     Note = note;
 }
Exemplo n.º 24
0
 public MatrixAnimation(Matrix fromValue, Matrix toValue, Duration duration, FillBehavior fillBehavior)
 {
     From = fromValue;
     To = toValue;
     Duration = duration;
     FillBehavior = fillBehavior;
 }
 public QuestionFadeInAnimation()
 {
     To = 1;
     From = 0;
     Duration = new Duration(TimeSpan.FromMilliseconds(500));
     Storyboard.SetTargetProperty(this, new PropertyPath("Opacity"));
 }
Exemplo n.º 26
0
 public Tween(Equations type, double from, double to, Duration duration)
 {
     Equation = type;
     From = from;
     To = to;
     Duration = duration;
 }
Exemplo n.º 27
0
		public void DefaultValues ()
		{
			Duration d = new Duration ();
			Assert.AreEqual (false, d.HasTimeSpan, "HasTimeSpan");
			Assert.Throws<InvalidOperationException> (() => { object o = d.TimeSpan; GC.KeepAlive(o); }, "TimeSpan");
			Assert.AreEqual ("Automatic", d.ToString (), "ToString");
		}
Exemplo n.º 28
0
         /// <summary>
         /// Checks that the actual duration is less (strictly) than a comparand.
         /// </summary>
         /// <param name="check">The fluent check to be extended.</param>
         /// <param name="comparand">The value to compare to.</param>
         /// <returns>A check link.</returns>
         /// <exception cref="FluentCheckException">The actual value is not less than the provided comparand.</exception>
         public static ICheckLink<ICheck<TimeSpan>> IsLessThan(this ICheck<TimeSpan> check, TimeSpan comparand)
         {
             var checker = ExtensibilityHelper.ExtractChecker(check);

             var unit = TimeHelper.DiscoverUnit(comparand);

             var testedDuration = new Duration(checker.Value, unit);
             var expected = new Duration(comparand, unit);

             var notMessage =
                 checker.BuildMessage("The {0} is not more than the limit.")
                                .On(testedDuration)
                                .And.Expected(expected)
                                .Comparison("more than or equal to");
             var message =
                 checker.BuildMessage("The {0} is more than the limit.")
                                .On(testedDuration)
                                .And.Expected(expected).Comparison("less than");

             return checker.ExecuteCheck(
                 () =>
                 {
                     if (testedDuration >= expected)
                     {
                         throw new FluentCheckException(message.ToString());
                     }
                 }, 
                 notMessage.ToString());
         }
Exemplo n.º 29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Reactive" /> struct.
 /// </summary>
 /// <param name="color">Color to apply when key is hit.</param>
 /// <param name="duration">Duration to illuminate the key.</param>
 public Reactive(Color color, Duration duration)
 {
     Color    = color;
     Duration = duration;
 }
Exemplo n.º 30
0
        private void OnOpened(object sender, EventArgs e)
        {
            Keyboard.Focus(SearchBox);

            switch (taskbarEdge)
            {
            case Edge.Top:
                Placement = PlacementMode.Bottom;
                PopupBorder.BorderThickness = new Thickness(1);
                PopupMarginBorder.Margin    = new Thickness(10, 0, 10, 10);
                break;

            case Edge.Left:
                Placement = PlacementMode.Right;
                PopupBorder.BorderThickness = new Thickness(1);
                PopupMarginBorder.Margin    = new Thickness(0, 10, 10, 10);
                break;

            case Edge.Right:
                Placement = PlacementMode.Left;
                PopupBorder.BorderThickness = new Thickness(1);
                PopupMarginBorder.Margin    = new Thickness(10, 10, 0, 10);
                break;

            case Edge.Bottom:
                Placement = PlacementMode.Top;
                PopupBorder.BorderThickness = new Thickness(1, 1, 1, 0);
                PopupMarginBorder.Margin    = new Thickness(10, 10, 10, 0);
                break;
            }

            Height = Properties.Settings.Default.popupSize.Height;
            Width  = Properties.Settings.Default.popupSize.Width;

            QuinticEase ease = new QuinticEase
            {
                EasingMode = EasingMode.EaseOut
            };

            int             modifier = taskbarEdge == Edge.Right || taskbarEdge == Edge.Bottom ? 1 : -1;
            Duration        duration = TimeSpan.FromSeconds(Properties.Settings.Default.isAnimationsDisabled ? 0 : 0.4);
            DoubleAnimation outer    = new DoubleAnimation(modifier * 150, 0, duration)
            {
                EasingFunction = ease
            };
            DependencyProperty outerProp = taskbarEdge == Edge.Bottom || taskbarEdge == Edge.Top ? TranslateTransform.YProperty : TranslateTransform.XProperty;

            translateTransform?.BeginAnimation(outerProp, outer);

            DoubleAnimation opacity = new DoubleAnimation(0, 1, duration)
            {
                EasingFunction = ease
            };

            PopupMarginBorder?.BeginAnimation(OpacityProperty, opacity);

            duration = TimeSpan.FromSeconds(Properties.Settings.Default.isAnimationsDisabled ? 0 : 0.8);
            ThicknessAnimation inner = new ThicknessAnimation(new Thickness(0), duration)
            {
                EasingFunction = ease
            };

            if (taskbarEdge == Edge.Top)
            {
                inner.From = new Thickness(0, -50, 0, 50);
            }
            else if (taskbarEdge == Edge.Right)
            {
                inner.From = new Thickness(50, 0, -50, 0);
            }
            else if (taskbarEdge == Edge.Bottom)
            {
                inner.From = new Thickness(0, 50, 0, -50);
            }
            else if (taskbarEdge == Edge.Left)
            {
                inner.From = new Thickness(-50, 0, 50, 0);
            }
            ContentGrid?.BeginAnimation(MarginProperty, inner);
        }
Exemplo n.º 31
0
        public void VolumeDividedByDurationEqualsVolumeFlow()
        {
            VolumeFlow volumeFlow = Volume.FromCubicMeters(20) / Duration.FromSeconds(2);

            Assert.Equal(VolumeFlow.FromCubicMetersPerSecond(10), volumeFlow);
        }
Exemplo n.º 32
0
 public static TimeSpan Resolve(Duration value)
 {
     return(value.ToTimeSpan());
 }
Exemplo n.º 33
0
 private Instant FutureDays(int days)
 {
     return(now.WithoutMs().Plus(Duration.FromDays(days)));
 }
Exemplo n.º 34
0
 public static Duration AsDuration(TimeSpan value)
 {
     return(Duration.FromTimeSpan(value));
 }
Exemplo n.º 35
0
        internal TranscriptionStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
        {
            var inputBucket  = new Bucket(this, "Input");
            var outputBucket = new Bucket(this, "Output");

            var languageCode = this.Node.TryGetContext("LanguageCode")?.ToString();

            if (string.IsNullOrEmpty(languageCode))
            {
                languageCode = "en-us";
            }

            var startJobFunction = new Function(this, "StartJobFunction", new FunctionProps
            {
                Tracing     = Tracing.ACTIVE,
                Runtime     = Runtime.DOTNET_CORE_2_1,
                Timeout     = Duration.Seconds(30),
                MemorySize  = 256,
                Environment = new Dictionary <string, string>()
                {
                    { "TRANSCRIBE_OUTPUT_BUCKET", outputBucket.BucketName },
                    { "TRANSCRIBE_LANGUAGE_CODE", languageCode }
                },
                FunctionName = "StartTranscriptionJob",
                Code         = Code.FromAsset("./assets/StartTranscriptionJob.zip"),
                Handler      = "StartTranscriptionJob::StartTranscriptionJob.Function::FunctionHandler",
                Events       = new[]
                {
                    new S3EventSource(inputBucket, new S3EventSourceProps
                    {
                        Events = new [] { EventType.OBJECT_CREATED }
                    })
                }
            });

            startJobFunction.AddToRolePolicy(new PolicyStatement(new PolicyStatementProps
            {
                Actions   = new[] { "transcribe:StartTranscriptionJob" },
                Effect    = Effect.ALLOW,
                Resources = new[] { "*" }
            }));
            // this is passed onto Transcribe so it can write to the output bucket
            startJobFunction.AddToRolePolicy(new PolicyStatement(new PolicyStatementProps
            {
                Actions   = new[] { "s3:Put*" },
                Effect    = Effect.ALLOW,
                Resources = new[] { outputBucket.ArnForObjects("*") }
            }));

            inputBucket.GrantRead(startJobFunction);

            var notificationTopic = new Topic(this, "TranscriptionNotificationTopic", new TopicProps
            {
                TopicName = "TranscriptionCompletedTopic",
            });

            var subscriberEmail = this.Node.TryGetContext("SubscriberEmail")?.ToString();

            if (!string.IsNullOrEmpty(subscriberEmail))
            {
                notificationTopic.AddSubscription(new EmailSubscription(subscriberEmail));
            }

            var notifyCompletionFunction = new Function(this, "NotifyCompleteFunction", new FunctionProps
            {
                Tracing     = Tracing.ACTIVE,
                Runtime     = Runtime.DOTNET_CORE_2_1,
                Timeout     = Duration.Seconds(30),
                MemorySize  = 256,
                Environment = new Dictionary <string, string>()
                {
                    { "TRANSCRIBE_TOPIC_ARN", notificationTopic.TopicArn }
                },
                FunctionName = "NotifyTranscriptionJobComplete",
                Code         = Code.FromAsset("./assets/NotifyTranscriptionJobComplete.zip"),
                Handler      = "NotifyTranscriptionJobComplete::NotifyTranscriptionJobComplete.Function::FunctionHandler",
                Events       = new[]
                {
                    new S3EventSource(outputBucket, new S3EventSourceProps
                    {
                        Events = new [] { EventType.OBJECT_CREATED }
                    })
                }
            });

            notifyCompletionFunction.AddToRolePolicy(new PolicyStatement(new PolicyStatementProps
            {
                Actions   = new[] { "sns:Publish" },
                Effect    = Effect.ALLOW,
                Resources = new[] { notificationTopic.TopicArn }
            }));
            notifyCompletionFunction.AddToRolePolicy(new PolicyStatement(new PolicyStatementProps
            {
                // this permission is needed to allow the presigned url that the Lambda generates
                // to work and not yield an access-denied error
                Actions   = new[] { "s3:GetObject" },
                Effect    = Effect.ALLOW,
                Resources = new[] { outputBucket.ArnForObjects("*") }
            }));

            outputBucket.GrantWrite(notifyCompletionFunction);

            // emit the name of the input bucket so we know where to upload content!
            new CfnOutput(this, "InputBucket", new CfnOutputProps
            {
                Value = inputBucket.BucketName
            });
        }
Exemplo n.º 36
0
 private FakeClock CreateClock(TimeSpan autoAdvance)
 => new FakeClock(Instant.FromDateTimeOffset(_utcNow), Duration.FromTimeSpan(autoAdvance));
Exemplo n.º 37
0
 /// <summary>
 /// Create Note element.
 /// </summary>
 /// <param name="note">Note of sound.</param>
 /// <param name="octave">Octave of sound.</param>
 /// <param name="duration">Duration of sound in melody sequence timeline.</param>
 public NoteElement(Note note, Octave octave, Duration duration)
     : base(duration)
 {
     Note   = note;
     Octave = octave;
 }
Exemplo n.º 38
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MediaComponent"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="streamIndex">Index of the stream.</param>
        /// <exception cref="ArgumentNullException">container</exception>
        /// <exception cref="MediaContainerException">The container exception.</exception>
        protected MediaComponent(MediaContainer container, int streamIndex)
        {
            // Ported from: https://github.com/FFmpeg/FFmpeg/blob/master/fftools/ffplay.c#L2559
            // avctx = avcodec_alloc_context3(NULL);
            Container    = container ?? throw new ArgumentNullException(nameof(container));
            CodecContext = ffmpeg.avcodec_alloc_context3(null);
            RC.Current.Add(CodecContext, $"134: {nameof(MediaComponent)}[{MediaType}].ctor()");
            StreamIndex = streamIndex;
            Stream      = container.InputContext->streams[StreamIndex];
            StreamInfo  = container.MediaInfo.Streams[StreamIndex];

            // Set default codec context options from probed stream
            var setCodecParamsResult = ffmpeg.avcodec_parameters_to_context(CodecContext, Stream->codecpar);

            if (setCodecParamsResult < 0)
            {
                Container.Parent?.Log(MediaLogMessageType.Warning, $"Could not set codec parameters. Error code: {setCodecParamsResult}");
            }

            // We set the packet timebase in the same timebase as the stream as opposed to the tpyical AV_TIME_BASE
            if (this is VideoComponent && Container.MediaOptions.VideoForcedFps > 0)
            {
                var fpsRational = ffmpeg.av_d2q(Container.MediaOptions.VideoForcedFps, 1000000);
                Stream->r_frame_rate       = fpsRational;
                CodecContext->pkt_timebase = new AVRational {
                    num = fpsRational.den, den = fpsRational.num
                };
            }
            else
            {
                CodecContext->pkt_timebase = Stream->time_base;
            }

            // Find the default decoder codec from the stream and set it.
            var      defaultCodec = ffmpeg.avcodec_find_decoder(Stream->codec->codec_id);
            AVCodec *forcedCodec  = null;

            // If set, change the codec to the forced codec.
            if (Container.MediaOptions.DecoderCodec.ContainsKey(StreamIndex) &&
                string.IsNullOrWhiteSpace(Container.MediaOptions.DecoderCodec[StreamIndex]) == false)
            {
                var forcedCodecName = Container.MediaOptions.DecoderCodec[StreamIndex];
                forcedCodec = ffmpeg.avcodec_find_decoder_by_name(forcedCodecName);
                if (forcedCodec == null)
                {
                    Container.Parent?.Log(MediaLogMessageType.Warning,
                                          $"COMP {MediaType.ToString().ToUpperInvariant()}: Unable to set decoder codec to '{forcedCodecName}' on stream index {StreamIndex}");
                }
            }

            // Check we have a valid codec to open and process the stream.
            if (defaultCodec == null && forcedCodec == null)
            {
                var errorMessage = $"Fatal error. Unable to find suitable decoder for {Stream->codec->codec_id.ToString()}";
                CloseComponent();
                throw new MediaContainerException(errorMessage);
            }

            var      codecCandidates = new AVCodec *[] { forcedCodec, defaultCodec };
            AVCodec *selectedCodec   = null;
            var      codecOpenResult = 0;

            foreach (var codec in codecCandidates)
            {
                if (codec == null)
                {
                    continue;
                }

                // Pass default codec stuff to the codec contect
                CodecContext->codec_id = codec->id;

                // Legacy code from ffplay.c (v < 4.0) befor the send packet/receive frame logic, this used to be required.
                // Now it only corrupts frame decoding. See issue #251
                // if ((codec->capabilities & ffmpeg.AV_CODEC_CAP_TRUNCATED) != 0) CodecContext->flags |= ffmpeg.AV_CODEC_FLAG_TRUNCATED;
                // if ((codec->capabilities & ffmpeg.AV_CODEC_FLAG2_CHUNKS) != 0) CodecContext->flags |= ffmpeg.AV_CODEC_FLAG2_CHUNKS;

                // Process the decoder options
                {
                    var decoderOptions = Container.MediaOptions.DecoderParams;

                    // Configure the codec context flags
                    if (decoderOptions.EnableFastDecoding)
                    {
                        CodecContext->flags2 |= ffmpeg.AV_CODEC_FLAG2_FAST;
                    }
                    if (decoderOptions.EnableLowDelayDecoding)
                    {
                        CodecContext->flags |= ffmpeg.AV_CODEC_FLAG_LOW_DELAY;
                    }

                    // process the low res option
                    if (decoderOptions.LowResolutionIndex != ResolutionDivider.Full && codec->max_lowres > 0)
                    {
                        var lowResOption = Math.Min((byte)decoderOptions.LowResolutionIndex, codec->max_lowres)
                                           .ToString(CultureInfo.InvariantCulture);
                        decoderOptions.LowResIndexOption = lowResOption;
                    }

                    // Ensure ref counted frames for audio and video decoding
                    if (CodecContext->codec_type == AVMediaType.AVMEDIA_TYPE_VIDEO || CodecContext->codec_type == AVMediaType.AVMEDIA_TYPE_AUDIO)
                    {
                        decoderOptions.RefCountedFrames = "1";
                    }
                }

                // Setup additional settings. The most important one is Threads -- Setting it to 1 decoding is very slow. Setting it to auto
                // decoding is very fast in most scenarios.
                var codecOptions = Container.MediaOptions.DecoderParams.GetStreamCodecOptions(Stream->index);

                // Enable Hardware acceleration if requested
                if (this is VideoComponent && container.MediaOptions.VideoHardwareDevice != null)
                {
                    HardwareAccelerator.Attach(this as VideoComponent, container.MediaOptions.VideoHardwareDevice);
                }

                // Open the CodecContext. This requires exclusive FFmpeg access
                lock (CodecLock)
                {
                    fixed(AVDictionary **codecOptionsRef = &codecOptions.Pointer)
                    codecOpenResult = ffmpeg.avcodec_open2(CodecContext, codec, codecOptionsRef);
                }

                // Check if the codec opened successfully
                if (codecOpenResult < 0)
                {
                    Container.Parent?.Log(MediaLogMessageType.Warning,
                                          $"Unable to open codec '{FFInterop.PtrToStringUTF8(codec->name)}' on stream {streamIndex}");

                    continue;
                }

                // If there are any codec options left over from passing them, it means they were not consumed
                var currentEntry = codecOptions.First();
                while (currentEntry != null && currentEntry?.Key != null)
                {
                    Container.Parent?.Log(MediaLogMessageType.Warning,
                                          $"Invalid codec option: '{currentEntry.Key}' for codec '{FFInterop.PtrToStringUTF8(codec->name)}', stream {streamIndex}");
                    currentEntry = codecOptions.Next(currentEntry);
                }

                selectedCodec = codec;
                break;
            }

            if (selectedCodec == null)
            {
                CloseComponent();
                throw new MediaContainerException($"Unable to find suitable decoder codec for stream {streamIndex}. Error code {codecOpenResult}");
            }

            // Startup done. Set some options.
            Stream->discard = AVDiscard.AVDISCARD_DEFAULT;
            MediaType       = (MediaType)CodecContext->codec_type;

            switch (MediaType)
            {
            case MediaType.Audio:
            case MediaType.Video:
                DecodePacketFunction = DecodeNextAVFrame;
                break;

            case MediaType.Subtitle:
                DecodePacketFunction = DecodeNextAVSubtitle;
                break;

            default:
                throw new NotSupportedException($"A compoenent of MediaType '{MediaType}' is not supported");
            }

            // Compute the start time
            if (Stream->start_time == ffmpeg.AV_NOPTS_VALUE)
            {
                StartTimeOffset = Container.MediaStartTimeOffset;
            }
            else
            {
                StartTimeOffset = Stream->start_time.ToTimeSpan(Stream->time_base);
            }

            // compute the duration
            if (Stream->duration == ffmpeg.AV_NOPTS_VALUE || Stream->duration == 0)
            {
                Duration = Container.InputContext->duration.ToTimeSpan();
            }
            else
            {
                Duration = Stream->duration.ToTimeSpan(Stream->time_base);
            }

            CodecId   = Stream->codec->codec_id;
            CodecName = FFInterop.PtrToStringUTF8(selectedCodec->name);
            Bitrate   = Stream->codec->bit_rate < 0 ? 0 : Convert.ToUInt64(Stream->codec->bit_rate);
            Container.Parent?.Log(MediaLogMessageType.Debug,
                                  $"COMP {MediaType.ToString().ToUpperInvariant()}: Start Offset: {StartTimeOffset.Format()}; Duration: {Duration.Format()}");

            // Begin processing with a flush packet
            SendFlushPacket();
        }
Exemplo n.º 39
0
        public void Duration_ParsePartialFractionalSecondsWithTrailingZeroes()
        {
            var parsed = JsonConvert.DeserializeObject <Duration>("\"25:10:00.1234000\"", NodaConverters.DurationConverter);

            Assert.AreEqual(Duration.FromHours(25) + Duration.FromMinutes(10) + Duration.FromTicks(1234000), parsed);
        }
Exemplo n.º 40
0
        private async Task <object> Convert(CommandMessage message, string arg, Type type)
        {
#pragma warning disable SA1121, IDE0049
            if (type == typeof(string))
            {
                if (!arg.Contains("\""))
                {
                    throw new Exception("strings must be wrapped in quotations");
                }

                return(arg.Replace("\"", string.Empty));
            }
            else if (type == typeof(double))
            {
                return(double.Parse(arg));
            }
            else if (type == typeof(int))
            {
                return(int.Parse(arg));
            }
            else if (type == typeof(uint))
            {
                return(uint.Parse(arg));
            }
            else if (type == typeof(UInt64))
            {
                return(UInt64.Parse(arg));
            }
            else if (type == typeof(bool))
            {
                return(bool.Parse(arg));
            }
            else if (type == typeof(SocketTextChannel))
            {
                string str = arg;
                str = str.Replace("<", string.Empty);
                str = str.Replace(">", string.Empty);
                str = str.Replace("#", string.Empty);

                ulong         id      = ulong.Parse(str);
                SocketChannel channel = Program.DiscordClient.GetChannel(id);
                if (channel is SocketTextChannel)
                {
                    return(channel);
                }
                else if (channel is null)
                {
                    throw new Exception("Invalid channel ID: " + id);
                }
                else
                {
                    throw new Exception("Channel is not a Text Channel");
                }
            }
            else if (type == typeof(IEmote))
            {
                IEmote emote = EmoteUtility.Parse(arg);

                if (emote is Emote emoteActual && !emoteActual.IsAvailable())
                {
                    throw new UserException("I'm sorry, I don't have that emote.");
                }

                return(emote);
            }
            else if (type == typeof(IUser))
            {
                string str = arg;
                str = str.Replace("<", string.Empty);
                str = str.Replace(">", string.Empty);
                str = str.Replace("@", string.Empty);
                str = str.Replace("!", string.Empty);

                ulong id   = ulong.Parse(str);
                IUser user = Program.DiscordClient.GetUser(id);

                if (user == null)
                {
                    throw new Exception("Invalid user Id: " + arg);
                }

                return(user);
            }
            else if (type == typeof(IGuildUser))
            {
                string str = arg;
                str = str.Replace("<", string.Empty);
                str = str.Replace(">", string.Empty);
                str = str.Replace("@", string.Empty);
                str = str.Replace("!", string.Empty);

                ulong      id   = ulong.Parse(str);
                IGuildUser user = await message.Guild.GetUserAsync(id);

                if (user == null)
                {
                    throw new Exception("Invalid user Id: " + arg);
                }

                return(user);
            }
            else if (type == typeof(IRole))
            {
                // <@&663326776696504352>
                string str = arg;
                str = str.Replace("<@&", string.Empty);
                str = str.Replace(">", string.Empty);

                ulong id   = ulong.Parse(str);
                IRole role = message.Guild.GetRole(id);

                if (role == null)
                {
                    throw new Exception("Invalid role Id: " + arg);
                }

                return(role);
            }
            else if (type == typeof(Duration))
            {
                string   str   = arg.ToLower();
                string[] parts = Regex.Split(str, @"(?<=[dhms])");

                Duration duration = Duration.FromSeconds(0);

                foreach (string part in parts)
                {
                    if (part.Contains('d'))
                    {
                        int val = int.Parse(part.Replace('d', '\0'));
                        duration += Duration.FromDays(val);
                    }
                    else if (part.Contains('h'))
                    {
                        int val = int.Parse(part.Replace('h', '\0'));
                        duration += Duration.FromHours(val);
                    }
                    else if (part.Contains('m'))
                    {
                        int val = int.Parse(part.Replace('m', '\0'));
                        duration += Duration.FromMinutes(val);
                    }
                    else if (part.Contains('s'))
                    {
                        int val = int.Parse(part.Replace('s', '\0'));
                        duration += Duration.FromSeconds(val);
                    }
                }

                return(duration);
            }

            throw new Exception("Unsupported parameter type: \"" + type + "\"");
#pragma warning restore
        }
Exemplo n.º 41
0
 public void Duration_WholeSeconds()
 {
     AssertConversions(Duration.FromHours(48), "\"48:00:00\"", NodaConverters.DurationConverter);
 }
Exemplo n.º 42
0
            internal static BclAdjustmentRule FromUnixAdjustmentRule(TimeZoneInfo zone, TimeZoneInfo.AdjustmentRule rule)
            {
                // On .NET Core on Unix, each "adjustment rule" is effectively just a zone interval. The transitions are only used
                // to give the time of day values to combine with rule.DateStart and rule.DateEnd. It's all a bit odd.
                // The *last* adjustment rule internally can work like a normal Windows standard/daylight rule, but currently that's
                // not exposed properly.
                var bclLocalStart = rule.DateStart + rule.DaylightTransitionStart.TimeOfDay.TimeOfDay;
                var bclLocalEnd   = rule.DateEnd + rule.DaylightTransitionEnd.TimeOfDay.TimeOfDay;
                var bclUtcStart   = DateTime.SpecifyKind(bclLocalStart == DateTime.MinValue ? DateTime.MinValue : bclLocalStart - zone.BaseUtcOffset, DateTimeKind.Utc);
                var bclWallOffset = zone.GetUtcOffset(bclUtcStart);
                var bclSavings    = rule.DaylightDelta;
                var bclUtcEnd     = DateTime.SpecifyKind(rule.DateEnd == MaxDate ? DateTime.MaxValue : bclLocalEnd - (zone.BaseUtcOffset + bclSavings), DateTimeKind.Utc);
                var isDst         = zone.IsDaylightSavingTime(bclUtcStart);

                // The BCL rule can't express "It's DST with a changed standard time" so we sometimes end
                // up with DST but no savings. Assume this means a savings of 1 hour. That's not a valid
                // assumption in all cases, but it's probably better than alternatives, given limited information.
                if (isDst && bclSavings == TimeSpan.Zero)
                {
                    bclSavings = TimeSpan.FromHours(1);
                }
                // Sometimes the rule says "This rule doesn't apply daylight savings" but still has a daylight
                // savings delta. Extremely bizarre: just override the savings to zero.
                if (!isDst && bclSavings != TimeSpan.Zero)
                {
                    bclSavings = TimeSpan.Zero;
                }

                // Handle changes crossing the international date line, which are represented as savings of +/-23
                // hours (but could conceivably be more).
                if (bclSavings.Hours < -14)
                {
                    bclSavings += TimeSpan.FromDays(1);
                }
                else if (bclSavings.Hours > 14)
                {
                    bclSavings -= TimeSpan.FromDays(1);
                }
                var bclStandard = bclWallOffset - bclSavings;

                // Now all the values are sensible - and in particular, now the daylight savings are in a range that can be represented by
                // Offset - we can converted everything to Noda Time types.
                var nodaStart = bclUtcStart == DateTime.MinValue ? Instant.BeforeMinValue : bclUtcStart.ToInstant();
                // The representation returned to us (not the internal representation) has an end point one second before the transition.
                var nodaEnd        = bclUtcEnd == DateTime.MaxValue ? Instant.AfterMaxValue : bclUtcEnd.ToInstant() + Duration.FromSeconds(1);
                var nodaWallOffset = bclWallOffset.ToOffset();
                var nodaStandard   = bclStandard.ToOffset();
                var nodaSavings    = bclSavings.ToOffset();

                var partialMap = PartialZoneIntervalMap.ForZoneInterval(isDst ? zone.StandardName : zone.DaylightName, nodaStart, nodaEnd, nodaWallOffset, nodaSavings);

                return(new BclAdjustmentRule(nodaStart, nodaEnd, nodaStandard, nodaSavings, partialMap));
            }
Exemplo n.º 43
0
        static void StartAnimation(DependencyObject target, CSSEquivalent cssEquivalent, double?from, object to, Duration Duration, EasingFunctionBase easingFunction, string visualStateGroupName, Action callbackForWhenfinished = null)
        {
            if (cssEquivalent.Name != null && cssEquivalent.Name.Count != 0)
            {
                UIElement uiElement = cssEquivalent.UIElement ?? (target as UIElement); // If no UIElement is specified, we assume that the property is intended to be applied to the instance on which the PropertyChanged has occurred.

                bool hasTemplate = (uiElement is Control) && ((Control)uiElement).HasTemplate;

                if (!hasTemplate || cssEquivalent.ApplyAlsoWhenThereIsAControlTemplate)
                {
                    if (cssEquivalent.DomElement == null && uiElement != null)
                    {
                        cssEquivalent.DomElement = uiElement.INTERNAL_OuterDomElement; // Default value
                    }
                    if (cssEquivalent.DomElement != null)
                    {
                        if (cssEquivalent.Value == null)
                        {
                            cssEquivalent.Value = (finalInstance, value) => { return(value ?? ""); }; // Default value
                        }
                        object cssValue = cssEquivalent.Value(target, to);



                        object newObj = CSHTML5.Interop.ExecuteJavaScriptAsync(@"new Object()");

                        if (from == null)
                        {
                            foreach (string csspropertyName in cssEquivalent.Name)
                            {
                                CSHTML5.Interop.ExecuteJavaScriptAsync(@"
$0[$1] = $2;", newObj, csspropertyName, cssValue);
                            }
                        }
                        else
                        {
                            foreach (string csspropertyName in cssEquivalent.Name)
                            {
                                CSHTML5.Interop.ExecuteJavaScriptAsync(@"
$0[$1] = [$2, $3];", newObj, csspropertyName, cssValue, from);
                            }
                        }

                        AnimationHelpers.CallVelocity(cssEquivalent.DomElement, Duration, easingFunction, visualStateGroupName, callbackForWhenfinished, newObj);
                    }
                }
            }
            else
            {
                throw new InvalidOperationException("Please set the Name property of the CSSEquivalent class.");
            }
        }
Exemplo n.º 44
0
 public void Duration_MinAndMaxValues()
 {
     AssertConversions(Duration.FromTicks(long.MaxValue), "\"256204778:48:05.4775807\"", NodaConverters.DurationConverter);
     AssertConversions(Duration.FromTicks(long.MinValue), "\"-256204778:48:05.4775808\"", NodaConverters.DurationConverter);
 }
Exemplo n.º 45
0
        public void DurationSpeedTimesEqualsLength()
        {
            Length length = Duration.FromSeconds(2) * Speed.FromMetersPerSecond(20);

            Assert.Equal(length, Length.FromMeters(40));
        }
Exemplo n.º 46
0
 static public string ToString(Duration input)
 {
     return(input.ToString());
 }
Exemplo n.º 47
0
        public void LengthDividedByDurationEqualsSpeed()
        {
            Speed speed = Length.FromMeters(20) / Duration.FromSeconds(2);

            Assert.Equal(speed, Speed.FromMetersPerSecond(10));
        }
 public NoteHeadGlyph(float x, float y, Duration duration, bool isGrace)
     : base(x, y, isGrace ? GraceScale : 1, GetSymbol(duration))
 {
     _isGrace  = isGrace;
     _duration = duration;
 }
Exemplo n.º 49
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MediaComponent"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="streamIndex">Index of the stream.</param>
        /// <exception cref="ArgumentNullException">container</exception>
        /// <exception cref="MediaContainerException">The container exception.</exception>
        protected MediaComponent(MediaContainer container, int streamIndex)
        {
            Container    = container ?? throw new ArgumentNullException(nameof(container));
            CodecContext = ffmpeg.avcodec_alloc_context3(null);
            RC.Current.Add(CodecContext, $"134: {nameof(MediaComponent)}[{MediaType}].ctor()");
            StreamIndex = streamIndex;
            Stream      = container.InputContext->streams[StreamIndex];
            StreamInfo  = container.MediaInfo.Streams[StreamIndex];

            // Set codec options
            var setCodecParamsResult = ffmpeg.avcodec_parameters_to_context(CodecContext, Stream->codecpar);

            if (setCodecParamsResult < 0)
            {
                Container.Parent?.Log(MediaLogMessageType.Warning, $"Could not set codec parameters. Error code: {setCodecParamsResult}");
            }

            // We set the packet timebase in the same timebase as the stream as opposed to the tpyical AV_TIME_BASE
            ffmpeg.av_codec_set_pkt_timebase(CodecContext, Stream->time_base);

            // Find the codec and set it.
            var codec = ffmpeg.avcodec_find_decoder(Stream->codec->codec_id);

            if (codec == null)
            {
                var errorMessage = $"Fatal error. Unable to find suitable decoder for {Stream->codec->codec_id.ToString()}";
                CloseComponent();
                throw new MediaContainerException(errorMessage);
            }

            CodecContext->codec_id = codec->id;

            // Process the low res index option
            var lowResIndex = ffmpeg.av_codec_get_max_lowres(codec);

            if (Container.MediaOptions.EnableLowRes)
            {
                ffmpeg.av_codec_set_lowres(CodecContext, lowResIndex);
                CodecContext->flags |= ffmpeg.CODEC_FLAG_EMU_EDGE;
            }
            else
            {
                lowResIndex = 0;
            }

            // Configure the codec context flags
            if (Container.MediaOptions.EnableFastDecoding)
            {
                CodecContext->flags2 |= ffmpeg.AV_CODEC_FLAG2_FAST;
            }
            if ((codec->capabilities & ffmpeg.AV_CODEC_CAP_DR1) != 0)
            {
                CodecContext->flags |= ffmpeg.CODEC_FLAG_EMU_EDGE;
            }
            if ((codec->capabilities & ffmpeg.AV_CODEC_CAP_TRUNCATED) != 0)
            {
                CodecContext->flags |= ffmpeg.AV_CODEC_CAP_TRUNCATED;
            }
            if ((codec->capabilities & ffmpeg.CODEC_FLAG2_CHUNKS) != 0)
            {
                CodecContext->flags |= ffmpeg.CODEC_FLAG2_CHUNKS;
            }

            // Setup additional settings. The most important one is Threads -- Setting it to 1 decoding is very slow. Setting it to auto
            // decoding is very fast in most scenarios.
            var codecOptions = Container.MediaOptions.CodecOptions.FilterOptions(CodecContext->codec_id, Container.InputContext, Stream, codec);

            if (codecOptions.HasKey(MediaCodecOptions.Names.Threads) == false)
            {
                codecOptions[MediaCodecOptions.Names.Threads] = "auto";
            }

            if (lowResIndex != 0)
            {
                codecOptions[MediaCodecOptions.Names.LowRes] = lowResIndex.ToString(CultureInfo.InvariantCulture);
            }
            if (CodecContext->codec_type == AVMediaType.AVMEDIA_TYPE_VIDEO || CodecContext->codec_type == AVMediaType.AVMEDIA_TYPE_AUDIO)
            {
                codecOptions[MediaCodecOptions.Names.RefCountedFrames] = 1.ToString(CultureInfo.InvariantCulture);
            }

            // Enable Hardware acceleration if requested
            if (this is VideoComponent && container.MediaOptions.EnableHardwareAcceleration)
            {
                HardwareAccelerator.Cuda.AttachDevice(this as VideoComponent);
            }

            // Open the CodecContext. This requires exclusive FFmpeg access
            var codecOpenResult = 0;

            lock (CodecOpenLock)
            {
                fixed(AVDictionary **reference = &codecOptions.Pointer)
                codecOpenResult = ffmpeg.avcodec_open2(CodecContext, codec, reference);
            }

            // Check if the codec opened successfully
            if (codecOpenResult < 0)
            {
                CloseComponent();
                throw new MediaContainerException($"Unable to open codec. Error code {codecOpenResult}");
            }

            // If there are any codec options left over from passing them, it means they were not consumed
            var currentEntry = codecOptions.First();

            while (currentEntry != null && currentEntry?.Key != null)
            {
                Container.Parent?.Log(MediaLogMessageType.Warning, $"Invalid codec option: '{currentEntry.Key}'");
                currentEntry = codecOptions.Next(currentEntry);
            }

            // Startup done. Set some options.
            Stream->discard = AVDiscard.AVDISCARD_DEFAULT;
            MediaType       = (MediaType)CodecContext->codec_type;

            // Compute the start time
            if (Stream->start_time == ffmpeg.AV_NOPTS_VALUE)
            {
                StartTimeOffset = Container.MediaStartTimeOffset;
            }
            else
            {
                StartTimeOffset = Stream->start_time.ToTimeSpan(Stream->time_base);
            }

            // compute the duration
            if (Stream->duration == ffmpeg.AV_NOPTS_VALUE || Stream->duration == 0)
            {
                Duration = Container.InputContext->duration.ToTimeSpan();
            }
            else
            {
                Duration = Stream->duration.ToTimeSpan(Stream->time_base);
            }

            CodecId   = Stream->codec->codec_id;
            CodecName = ffmpeg.avcodec_get_name(CodecId);
            Bitrate   = Stream->codec->bit_rate < 0 ? 0 : Convert.ToUInt64(Stream->codec->bit_rate);
            Container.Parent?.Log(MediaLogMessageType.Debug,
                                  $"COMP {MediaType.ToString().ToUpperInvariant()}: Start Offset: {StartTimeOffset.Format()}; Duration: {Duration.Format()}");
        }
Exemplo n.º 50
0
        public void SpeedDividedByDurationEqualsAcceleration()
        {
            Acceleration acceleration = Speed.FromMetersPerSecond(20) / Duration.FromSeconds(2);

            Assert.Equal(acceleration, Acceleration.FromMetersPerSecondSquared(10));
        }
Exemplo n.º 51
0
        private static void OnRenderPressedChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            ImageButtonChrome buttonChrome = (ImageButtonChrome)o;

            if (!buttonChrome.Animates)
            {
                buttonChrome._localResources = null;
                buttonChrome.InvalidateVisual();
                return;
            }
            if ((bool)e.NewValue)
            {
                if (buttonChrome._localResources == null)
                {
                    buttonChrome._localResources = new ImageButtonChrome.LocalResources();
                    buttonChrome.InvalidateVisual();
                }
                Duration        duration  = new Duration(TimeSpan.FromSeconds(0.1));
                DoubleAnimation animation = new DoubleAnimation(1.0, duration);
                buttonChrome.BackgroundOverlay.BeginAnimation(Brush.OpacityProperty, animation);
                buttonChrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, animation);
                buttonChrome.LeftDropShadowBrush.BeginAnimation(Brush.OpacityProperty, animation);
                buttonChrome.TopDropShadowBrush.BeginAnimation(Brush.OpacityProperty, animation);
                animation = new DoubleAnimation(0.0, duration);
                buttonChrome.InnerBorderPen.Brush.BeginAnimation(Brush.OpacityProperty, animation);
                ColorAnimation         animation2    = new ColorAnimation(Color.FromRgb(194, 228, 246), duration);
                GradientStopCollection gradientStops = ((LinearGradientBrush)buttonChrome.BackgroundOverlay).GradientStops;
                gradientStops[0].BeginAnimation(GradientStop.ColorProperty, animation2);
                gradientStops[1].BeginAnimation(GradientStop.ColorProperty, animation2);
                animation2 = new ColorAnimation(Color.FromRgb(171, 218, 243), duration);
                gradientStops[2].BeginAnimation(GradientStop.ColorProperty, animation2);
                animation2 = new ColorAnimation(Color.FromRgb(144, 203, 235), duration);
                gradientStops[3].BeginAnimation(GradientStop.ColorProperty, animation2);
                animation2 = new ColorAnimation(Color.FromRgb(44, 98, 139), duration);
                buttonChrome.BorderOverlayPen.Brush.BeginAnimation(SolidColorBrush.ColorProperty, animation2);
                return;
            }
            if (buttonChrome._localResources == null)
            {
                buttonChrome.InvalidateVisual();
                return;
            }
            bool            renderMouseOver = buttonChrome.RenderMouseOver;
            Duration        duration2       = new Duration(TimeSpan.FromSeconds(0.1));
            DoubleAnimation doubleAnimation = new DoubleAnimation();

            doubleAnimation.Duration = duration2;
            buttonChrome.LeftDropShadowBrush.BeginAnimation(Brush.OpacityProperty, doubleAnimation);
            buttonChrome.TopDropShadowBrush.BeginAnimation(Brush.OpacityProperty, doubleAnimation);
            buttonChrome.InnerBorderPen.Brush.BeginAnimation(Brush.OpacityProperty, doubleAnimation);
            if (!renderMouseOver)
            {
                buttonChrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, doubleAnimation);
                buttonChrome.BackgroundOverlay.BeginAnimation(Brush.OpacityProperty, doubleAnimation);
            }
            ColorAnimation colorAnimation = new ColorAnimation();

            colorAnimation.Duration = duration2;
            buttonChrome.BorderOverlayPen.Brush.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation);
            GradientStopCollection gradientStops2 = ((LinearGradientBrush)buttonChrome.BackgroundOverlay).GradientStops;

            gradientStops2[0].BeginAnimation(GradientStop.ColorProperty, colorAnimation);
            gradientStops2[1].BeginAnimation(GradientStop.ColorProperty, colorAnimation);
            gradientStops2[2].BeginAnimation(GradientStop.ColorProperty, colorAnimation);
            gradientStops2[3].BeginAnimation(GradientStop.ColorProperty, colorAnimation);
        }
        public void SpeedTimesDurationEqualsLength()
        {
            Length length = Speed.FromMetersPerSecond(20) * Duration.FromSeconds(2);

            Assert.AreEqual(length, Length.FromMeters(40));
        }
Exemplo n.º 53
0
        /// <summary>
        /// Adds the XML representation of the result as a child of the
        /// supplied parent node..
        /// </summary>
        /// <param name="parentNode">The parent node.</param>
        /// <param name="recursive">If true, descendant results are included</param>
        /// <returns></returns>
        public virtual TNode AddToXml(TNode parentNode, bool recursive)
        {
            // A result node looks like a test node with extra info added
            TNode thisNode = Test.AddToXml(parentNode, false);

            thisNode.AddAttribute("result", ResultState.Status.ToString());
            if (ResultState.Label != string.Empty) // && ResultState.Label != ResultState.Status.ToString())
            {
                thisNode.AddAttribute("label", ResultState.Label);
            }
            if (ResultState.Site != FailureSite.Test)
            {
                thisNode.AddAttribute("site", ResultState.Site.ToString());
            }

            thisNode.AddAttribute("start-time", StartTime.ToString("u"));
            thisNode.AddAttribute("end-time", EndTime.ToString("u"));
            thisNode.AddAttribute("duration", Duration.ToString("0.000000", NumberFormatInfo.InvariantInfo));

            if (Test is TestSuite)
            {
                thisNode.AddAttribute("total", (PassCount + FailCount + SkipCount + InconclusiveCount).ToString());
                thisNode.AddAttribute("passed", PassCount.ToString());
                thisNode.AddAttribute("failed", FailCount.ToString());
                thisNode.AddAttribute("warnings", WarningCount.ToString());
                thisNode.AddAttribute("inconclusive", InconclusiveCount.ToString());
                thisNode.AddAttribute("skipped", SkipCount.ToString());
            }

            thisNode.AddAttribute("asserts", AssertCount.ToString());

            switch (ResultState.Status)
            {
            case TestStatus.Failed:
                AddFailureElement(thisNode);
                break;

            case TestStatus.Skipped:
            case TestStatus.Passed:
            case TestStatus.Inconclusive:
            case TestStatus.Warning:
                if (Message != null && Message.Trim().Length > 0)
                {
                    AddReasonElement(thisNode);
                }
                break;
            }

            if (Output.Length > 0)
            {
                AddOutputElement(thisNode);
            }

            if (AssertionResults.Count > 0)
            {
                AddAssertionsElement(thisNode);
            }

            if (_testAttachments.Count > 0)
            {
                AddAttachmentsElement(thisNode);
            }

            if (recursive && HasChildren)
            {
                foreach (TestResult child in Children)
                {
                    child.AddToXml(thisNode, recursive);
                }
            }

            return(thisNode);
        }
Exemplo n.º 54
0
        public void Subtract_ZonedDateTime()
        {
            using var ctx = CreateContext();
            var id = ctx.NodaTimeTypes
                     .Where(t => t.ZonedDateTime + Duration.FromDays(1) - t.ZonedDateTime == Duration.FromDays(1))
                     .Select(t => t.Id)
                     .Single();

            Assert.Equal(1, id);
            AssertSql(
                @"SELECT n.""Id""
FROM ""NodaTimeTypes"" AS n
WHERE ((n.""ZonedDateTime"" + INTERVAL '1 00:00:00') - n.""ZonedDateTime"") = INTERVAL '1 00:00:00'
LIMIT 2");
        }
Exemplo n.º 55
0
        public void TransitionToGrid(object selectedItem)
        {
            ((MainWindow)Application.Current.MainWindow).SetVoiceInstruction(string.Empty, 0);
            this.Visibility       = Visibility.Visible;
            this.IsHitTestVisible = false;

            // move all grid items to position of selected item
            var pt = new Point();
            var li = this.CategoryListBox.ItemContainerGenerator.ContainerFromItem(selectedItem) as ListBoxItem;

            if (li != null)
            {
                pt = li.TranslatePoint(new Point(li.ActualWidth / 2, li.ActualHeight / 2), this);
            }

            var sb = new Storyboard();

            double speedFactor = 0.0005;

            foreach (Category item in this.CategoryListBox.Items)
            {
                li = this.CategoryListBox.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
                if (li != null)
                {
                    Point itemPt = li.TranslatePoint(new Point(li.ActualWidth / 2, li.ActualHeight / 2), this);

                    double diffX = pt.X - itemPt.X;
                    double diffY = pt.Y - itemPt.Y;

                    li.RenderTransform = new TranslateTransform(diffX, diffY);

                    var d = new Duration(TimeSpan.FromSeconds(Math.Abs(diffY) * speedFactor));

                    var animateY = new DoubleAnimation(0, d);
                    animateY.BeginTime = TimeSpan.FromSeconds(0.5);

                    Storyboard.SetTarget(animateY, li);
                    Storyboard.SetTargetProperty(animateY, new PropertyPath("RenderTransform.Y"));
                    sb.Children.Add(animateY);

                    var d2       = new Duration(TimeSpan.FromSeconds(Math.Abs(diffX) * speedFactor));
                    var animateX = new DoubleAnimation(0, d2);
                    animateX.BeginTime = d.TimeSpan;
                    Storyboard.SetTarget(animateX, li);
                    Storyboard.SetTargetProperty(animateX, new PropertyPath("RenderTransform.X"));

                    sb.Children.Add(animateX);

                    var d3             = new Duration(d.TimeSpan + d2.TimeSpan);
                    var animateOpacity = new DoubleAnimation(1, d3);
                    animateOpacity.BeginTime = animateY.BeginTime;
                    Storyboard.SetTarget(animateOpacity, li);
                    Storyboard.SetTargetProperty(animateOpacity, new PropertyPath("Opacity"));

                    sb.Children.Add(animateOpacity);
                }
            }

            sb.Completed += this.TransitionToGridCompleted;
            sb.Begin();
        }
Exemplo n.º 56
0
 public ConstantTimeTimeoutStrategy(Duration backoffTime) : this(backoffTime.toMillis(), TimeUnit.MILLISECONDS)
 {
 }
 internal static void CopyOut(long from, ref Duration to)
 {
     to.OsDuration = from;
 }
Exemplo n.º 58
0
        public async Task Save_new_events()
        {
            // Arrange

            _db.Events.RemoveRange(_db.Events);

            await _db.SaveChangesAsync();

            // Act

            var events = new[]
            {
                new Event <string, string>("A", SpecificDate.BeforeChrist(10), SpecificDate.AnnoDomini(12)),
                new Event <string, string>("B", SpecificDate.BeforeChrist(20, 5)),
                new Event <string, string>("C", SpecificDate.AnnoDomini(2020, 1, 1), NowDate.Instance),
                new Event <string, string>("D", NowDate.Instance),
                new Event <string, string>("E", SpecificDate.BeforeChrist(100, 2, 3, 10), SpecificDate.BeforeChrist(100, 2, 3, 20)),
            };

            await _repo.SaveEventsAsync(events);

            // Assert

            var storedEvents = await _db.Events.ToArrayAsync();

            storedEvents.ShouldNotBeNull();
            storedEvents.Length.ShouldBe(5);

            var @event = storedEvents.FirstOrDefault(e => e.Content == "A");

            @event.ShouldNotBeNull();
            @event.StartIsCurrent.ShouldBeFalse();
            @event.StartDuration.ShouldNotBeNull();
            @event.StartDuration.Value.ShouldBe(Duration.GetDurationFromChristBirth(SpecificDate.BeforeChrist(10)));
            @event.StartNullPart.ShouldNotBeNull();
            @event.StartNullPart.ShouldBe(NullableDateParts.Month);
            @event.EndIsCurrent.ShouldNotBeNull();
            @event.EndIsCurrent.Value.ShouldBeFalse();
            @event.EndDuration.ShouldNotBeNull();
            @event.EndDuration.Value.ShouldBe(Duration.GetDurationFromChristBirth(SpecificDate.AnnoDomini(12)));
            @event.EndNullPart.ShouldNotBeNull();
            @event.EndNullPart.Value.ShouldBe(NullableDateParts.Month);

            @event = storedEvents.FirstOrDefault(e => e.Content == "B");
            @event.ShouldNotBeNull();
            @event.StartIsCurrent.ShouldBeFalse();
            @event.StartDuration.ShouldNotBeNull();
            @event.StartDuration.Value.ShouldBe(Duration.GetDurationFromChristBirth(SpecificDate.BeforeChrist(20, 5)));
            @event.StartNullPart.ShouldNotBeNull();
            @event.StartNullPart.ShouldBe(NullableDateParts.Day);
            @event.EndIsCurrent.ShouldBeNull();
            @event.EndDuration.ShouldBeNull();
            @event.EndNullPart.ShouldBeNull();

            @event = storedEvents.FirstOrDefault(e => e.Content == "C");
            @event.ShouldNotBeNull();
            @event.StartIsCurrent.ShouldBeFalse();
            @event.StartDuration.ShouldNotBeNull();
            @event.StartDuration.Value.ShouldBe(Duration.GetDurationFromChristBirth(SpecificDate.AnnoDomini(2020, 1, 1)));
            @event.StartNullPart.ShouldNotBeNull();
            @event.StartNullPart.ShouldBe(NullableDateParts.Hour);
            @event.EndIsCurrent.ShouldNotBeNull();
            @event.EndIsCurrent.Value.ShouldBeTrue();
            @event.EndDuration.ShouldBeNull();
            @event.EndNullPart.ShouldBeNull();

            @event = storedEvents.FirstOrDefault(e => e.Content == "D");
            @event.ShouldNotBeNull();
            @event.StartIsCurrent.ShouldBeTrue();
            @event.StartDuration.ShouldBeNull();
            @event.StartNullPart.ShouldBeNull();
            @event.EndIsCurrent.ShouldBeNull();
            @event.EndDuration.ShouldBeNull();
            @event.EndNullPart.ShouldBeNull();

            @event = storedEvents.FirstOrDefault(e => e.Content == "E");
            @event.ShouldNotBeNull();
            @event.StartIsCurrent.ShouldBeFalse();
            @event.StartDuration.ShouldNotBeNull();
            @event.StartDuration.Value.ShouldBe(Duration.GetDurationFromChristBirth(SpecificDate.BeforeChrist(100, 2, 3, 10)));
            @event.StartNullPart.ShouldNotBeNull();
            @event.StartNullPart.ShouldBe(NullableDateParts.Nothing);
            @event.EndIsCurrent.ShouldNotBeNull();
            @event.EndIsCurrent.Value.ShouldBeFalse();
            @event.EndDuration.ShouldNotBeNull();
            @event.EndDuration.Value.ShouldBe(Duration.GetDurationFromChristBirth(SpecificDate.BeforeChrist(100, 2, 3, 20)));
            @event.EndNullPart.ShouldNotBeNull();
            @event.EndNullPart.Value.ShouldBe(NullableDateParts.Nothing);

            events.ShouldAllBe(e => e.Id.HasValue);
        }
Exemplo n.º 59
-1
        private void frm_nav_Navigated(object sender, NavigationEventArgs e)
        {
            double translateTo = 0.0, translateFrom = 0.0;
            var currentStep = (int)App.Current.Properties[Constants.ApplicationProperties.CurrentStep];
            var nextStep = (int)App.Current.Properties[Constants.ApplicationProperties.NextStep];

            //switch (currentStep)
            //{
            //    case Constants.ApplicationProperties.Steps.step1:
            //        translateTo = txb_pg1.Margin.Top - rectangle1.Margin.Top;
            //        break;
            //    case Constants.ApplicationProperties.Steps.step2:
            //        translateTo = txb_pg2.Margin.Top - rectangle1.Margin.Top;
            //        translateFrom = txb_pg1.Margin.Top;
            //        break;
            //    case Constants.ApplicationProperties.Steps.step3:
            //        translateTo = txb_pg2.Margin.Top - rectangle1.Margin.Top;
            //        translateFrom = txb_pg1.Margin.Top;
            //        break;
            //    default:
            //        break;
            //}

            translateTo = nextStep;
            translateFrom = currentStep;


            App.Current.Properties["stepSlider"] = translateTo;
            var transform = new TranslateTransform();
            Duration duration = new Duration(new TimeSpan(0, 0, 0, 2, 0));
            DoubleAnimation anim = new DoubleAnimation(translateFrom, translateTo, duration);
            transform.BeginAnimation(TranslateTransform.YProperty, anim);
            rectangle1.RenderTransform = transform;
        }
Exemplo n.º 60
-1
 protected override void OnDurationChanged(Duration oldDuration, Duration newDuration)
 {
     if (this.OldContentStoryboard != null && this.OldContentStoryboard.Children.Count > 0)
     {
         this.OldContentStoryboard.Children[0].Duration = newDuration;
     }
 }