本文整理汇总了C#中Duration类的典型用法代码示例。如果您正苦于以下问题:C# Duration类的具体用法?C# Duration怎么用?C# Duration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Duration类属于命名空间,在下文中一共展示了Duration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: AnimateTranslateTransform
/// <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();
}
开发者ID:Zoomicon,项目名称:ZUI,代码行数:40,代码来源:AnimationExtensions.cs
示例17: Period
public Period(Date_Time start, Date_Time end)
: this()
{
StartTime = start;
EndTime = end;
Duration = new Duration(end.Value - start.Value);
}
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:7,代码来源:Period.cs
示例18: AnimateOpacity
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();
}
开发者ID:grantamos,项目名称:decibel,代码行数:25,代码来源:AnimationLibrary.cs
示例19: PennerDoubleAnimation
public PennerDoubleAnimation(Equations type, double from, double to, Duration duration)
{
Equation = type;
From = from;
To = to;
Duration = duration;
}
开发者ID:Klaudit,项目名称:inbox2_desktop,代码行数:7,代码来源:PennerDoubleAnimation.cs
示例20: AnimatedLoader
/// <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;
}
开发者ID:StevenThuriot,项目名称:Nova,代码行数:30,代码来源:AnimatedLoader.cs
注:本文中的Duration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论