当前位置: 首页>>代码示例>>C#>>正文


C# Duration类代码示例

本文整理汇总了C#中Duration的典型用法代码示例。如果您正苦于以下问题:C# Duration类的具体用法?C# Duration怎么用?C# Duration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Duration类属于命名空间,在下文中一共展示了Duration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getUnionDuration

        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);
        }
开发者ID:soross,项目名称:stockanalyzer,代码行数:7,代码来源:Duration.cs

示例2: QuadPointEasingAnimation

 /// <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;
 }
开发者ID:leowangzi,项目名称:DanielLib,代码行数:14,代码来源:QuadPointEasingAnimation.cs

示例3: Load

        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;
        }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:30,代码来源:OrbitFactory.cs

示例4: Advance

 /// <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;
     }
 }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:12,代码来源:FakeClock.cs

示例5: DismissEVHUD

        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();
                }

            };
        }
开发者ID:powerytg,项目名称:indulged-flickr,代码行数:31,代码来源:ProCamHUD.cs

示例6: AnimateEntry

        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);
            }
        }
开发者ID:gdlprj,项目名称:duscusys,代码行数:25,代码来源:PopupWindow.xaml.cs

示例7: PerformTranstition

        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();
        }
开发者ID:kuki89,项目名称:IP_Lab,代码行数:34,代码来源:WipeTransition.cs

示例8: Discard

 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);
 }
开发者ID:kpozin,项目名称:kinect_menu,代码行数:29,代码来源:MainWindow.xaml.cs

示例9: Entry

 public Entry(DateTime date, double duration, string activity, string note)
 {
     Date = date;
     Activity = activity;
     Duration = new Duration(duration);
     Note = note;
 }
开发者ID:archnaut,项目名称:sandbox,代码行数:7,代码来源:Entry.cs

示例10: MatrixAnimation

 public MatrixAnimation(Matrix fromValue, Matrix toValue, Duration duration, FillBehavior fillBehavior)
 {
     From = fromValue;
     To = toValue;
     Duration = duration;
     FillBehavior = fillBehavior;
 }
开发者ID:deurell,项目名称:Curla,代码行数:7,代码来源:MatrixAnimation.cs

示例11: Tween

 public Tween(Equations type, double from, double to, Duration duration)
 {
     Equation = type;
     From = from;
     To = to;
     Duration = duration;
 }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:7,代码来源:Tween.cs

示例12: QuestionFadeInAnimation

 public QuestionFadeInAnimation()
 {
     To = 1;
     From = 0;
     Duration = new Duration(TimeSpan.FromMilliseconds(500));
     Storyboard.SetTargetProperty(this, new PropertyPath("Opacity"));
 }
开发者ID:bobpace,项目名称:questionspike,代码行数:7,代码来源:QuestionFadeInAnimation.cs

示例13: IsLessThan

         /// <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());
         }
开发者ID:dirkrombauts,项目名称:NFluent,代码行数:36,代码来源:TimeSpanCheckExtensions.cs

示例14: DoubleAnimation

 public DoubleAnimation(double from, double to, Duration duration, FillBehavior fillBehavior)
 {
   this.From = from;
   this.To = to;
   this.Duration = duration;
   this.FillBehavior = fillBehavior;
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:7,代码来源:DoubleAnimation.cs

示例15: DefaultValues

		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");
		}
开发者ID:dfr0,项目名称:moon,代码行数:7,代码来源:DurationTest.cs


注:本文中的Duration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。