public int IndexOf(Clock clock) { if (clock == null) { throw new ArgumentNullException("clock"); } return List.IndexOf(clock); }
public void CopyTo(Clock[] array, int arrayIndex) { if (array == null) { throw new ArgumentNullException("array"); } List.CopyTo(array, arrayIndex); }
public bool Contains(Clock clock) { if (clock == null) { throw new ArgumentNullException("clock"); } return List.Contains(clock); }
public void Add(Clock clock) { if (clock == null) { throw new ArgumentNullException("clock"); } List.Add(clock); }
protected override Duration GetNaturalDurationCore (Clock clock) { throw new NotImplementedException (); }
protected internal Duration GetNaturalDuration (Clock clock) { throw new NotImplementedException (); }
protected override sealed Duration GetNaturalDurationCore(Clock clock) { throw new NotImplementedException(); }
/// <summary> /// Provide a custom natural Duration when the Duration property is set to Automatic. /// </summary> /// <param name="clock"> /// The Clock whose natural duration is desired. /// </param> /// <returns> /// If the last KeyFrame of this animation is a KeyTime, then this will /// be used as the NaturalDuration; otherwise it will be one second. /// </returns> protected override sealed Duration GetNaturalDurationCore(Clock clock) { return(new Duration(LargestTimeSpanKeyTime)); }
protected sealed override System.Windows.Duration GetNaturalDurationCore(Clock clock) { return(default(System.Windows.Duration)); }
/// <summary> /// Implemented by the class author to provide a custom natural Duration /// in the case that the Duration property is set to Automatic. If the author /// cannot determine the Duration, this method should return Automatic. /// </summary> /// <param name="clock"> /// The Clock whose natural duration is desired. /// </param> /// <returns> /// A Duration quantity representing the natural duration. /// </returns> protected virtual Duration GetNaturalDurationCore(Clock clock) { return(Duration.Automatic); }
public ClockCollection(Clock parent) { _parent = parent; }
/// <summary> /// Creates a new Clock using this Timeline as the root. If this /// Timeline has children, a tree of clocks will be created. /// </summary> /// <param name="hasControllableRoot">True if the root Clock returned should /// return a ClockController from its Controller property so that /// the Clock tree can be interactively controlled.</param> /// <remarks> /// Although this Timeline may be included as a child of one or more /// TimelineGroups, this information will be ignored. For the purposes /// of this method this Timeline will be treated as a root Timeline. /// </remarks> /// <returns> /// A new Clock or tree of Clocks depending on whether /// or not this Timeline is a TimelineGroup that contains children. /// </returns> public Clock CreateClock(bool hasControllableRoot) { // Create the tree of clocks from this timeline return(Clock.BuildClockTreeFromTimeline(this, hasControllableRoot)); }
/// <summary> /// Puts a Clock into a queue for firing events. /// </summary> /// <param name="sender"> /// The object sending the event. /// </param> /// <remarks> /// The time at which the event is actually raised is implementation-specific and is /// subject to change at any time. /// </remarks> internal void AddToEventQueue(Clock sender) { _eventQueue.Enqueue(sender.WeakReference); }
public void Insert(int index, Clock clock) { if (clock == null) { throw new ArgumentNullException("clock"); } List.Insert(index, clock); }
/// <summary> /// Given an object, and a clock to associate with 'this' Storyboard /// instance, save a reference to the clock on the object's attached storage /// for storyboard clocks. We are storing a weak reference so that the /// clock is not kept alive. Currently we don't have a way of removing /// clocks from the list when it is no longer required. /// </summary> /// <remarks> /// We don't care if there's already a clock there - if there is one, /// the reference is overridden in the HybridDictionary, and the old clock /// is abandoned. /// </remarks> private void SetStoryboardClock(DependencyObject o, Clock clock) { HybridDictionary clocks = StoryboardClockTreesField.GetValue(o); if (clocks == null) { clocks = new HybridDictionary(); StoryboardClockTreesField.SetValue(o, clocks); } clocks[this] = new WeakReference(clock); return; }
/// <summary> /// Returns the period of a single iteration. This will only be called when /// the Duration property is set to Automatic. If Duration is Automatic, /// the natural duration is determined by the nature of the specific timeline class, /// as determined by its author. If GetNaturalDuration returns Automatic, it means /// that the natural duration is unknown, which temporarily implies Forever. /// Streaming media would fit this case. /// </summary> /// <param name="clock"> /// The Clock whose natural duration is desired. /// </param> /// <returns> /// A Duration quantity representing the natural duration. /// </returns> internal protected Duration GetNaturalDuration(Clock clock) { return(GetNaturalDurationCore(clock)); }
/// <summary> /// Recursively walks the clock tree and determine the target object /// and property for each clock in the tree. /// </summary> /// <remarks> /// The currently active object and property path are passed in as parameters, /// they will be used unless a target/property specification exists on /// the Timeline object corresponding to the current clock. (So that the /// leaf-most reference wins.) /// /// The active object and property parameters may be null if they have /// never been specified. If we reach a leaf node clock and a needed attribute /// is still null, it is an error condition. Otherwise we keep hoping they'll be found. /// </remarks> private void ClockTreeWalkRecursive( Clock currentClock, /* No two calls will have the same currentClock */ DependencyObject containingObject, /* Remains the same through all the recursive calls */ INameScope nameScope, /* Remains the same through all the recursive calls */ DependencyObject parentObject, string parentObjectName, PropertyPath parentPropertyPath, HandoffBehavior handoffBehavior, /* Remains the same through all the recursive calls */ HybridDictionary clockMappings, Int64 layer /* Remains the same through all the recursive calls */) { Timeline currentTimeline = currentClock.Timeline; DependencyObject targetObject = parentObject; string currentObjectName = parentObjectName; PropertyPath currentPropertyPath = parentPropertyPath; // If we have target object/property information, use it instead of the // parent's information. string nameString = (string)currentTimeline.GetValue(TargetNameProperty); if( nameString != null ) { if( nameScope is Style ) { // We are inside a Style - we don't let people target anything. // They're only allowed to modify the Styled object, which is // already the implicit target. throw new InvalidOperationException(SR.Get(SRID.Storyboard_TargetNameNotAllowedInStyle, nameString)); } currentObjectName = nameString; } // The TargetProperty trumps the TargetName property. DependencyObject localTargetObject = (DependencyObject) currentTimeline.GetValue(TargetProperty); if( localTargetObject != null ) { targetObject = localTargetObject; currentObjectName = null; } PropertyPath propertyPath = (PropertyPath)currentTimeline.GetValue(TargetPropertyProperty); if( propertyPath != null ) { currentPropertyPath = propertyPath; } // Now see if the current clock is an animation clock if( currentClock is AnimationClock ) { DependencyProperty targetProperty = null; AnimationClock animationClock = (AnimationClock)currentClock; if( targetObject == null ) { // Resolve the target object name. If no name specified, use the // containing object. if( currentObjectName != null ) { DependencyObject mentor = Helper.FindMentor(containingObject); targetObject = ResolveTargetName(currentObjectName, nameScope, mentor); } else { // The containing object must be either an FE or FCE. // (Not a Storyboard, as used for "shared clocks" mode.) targetObject = containingObject as FrameworkElement; if(targetObject == null) { targetObject = containingObject as FrameworkContentElement; } if( targetObject == null ) { // The containing object is not an FE or FCE. throw new InvalidOperationException(SR.Get(SRID.Storyboard_NoTarget, currentTimeline.GetType().ToString() )); } } } // See if we have a property name to use. if( currentPropertyPath == null ) { throw new InvalidOperationException(SR.Get(SRID.Storyboard_TargetPropertyRequired, currentTimeline.GetType().ToString() )); } // A property name can be a straightforward property name (like "Angle") // but may be a more complex multi-step property path. The two cases // are handled differently. using(currentPropertyPath.SetContext(targetObject)) { if( currentPropertyPath.Length < 1 ) { throw new InvalidOperationException(SR.Get(SRID.Storyboard_PropertyPathEmpty)); } VerifyPathIsAnimatable(currentPropertyPath); if( currentPropertyPath.Length == 1 ) { // We have a simple single-step property. targetProperty = currentPropertyPath.GetAccessor(0) as DependencyProperty; if( targetProperty == null ) { // Unfortunately it's not a DependencyProperty. throw new InvalidOperationException(SR.Get(SRID.Storyboard_PropertyPathMustPointToDependencyProperty, currentPropertyPath.Path )); } VerifyAnimationIsValid(targetProperty, animationClock); ObjectPropertyPair animatedTarget = new ObjectPropertyPair(targetObject, targetProperty); UpdateMappings(clockMappings, animatedTarget, animationClock); } else // path.Length > 1 { // This is a multi-step property path that requires more extensive // setup. ProcessComplexPath(clockMappings, targetObject, currentPropertyPath, animationClock, handoffBehavior, layer); } } } else if ( currentClock is MediaClock ) // Not an animation clock - maybe a media clock? { // Yes it's a media clock. Try to find the corresponding object and // apply the clock to that object. ApplyMediaClock(nameScope, containingObject, targetObject, currentObjectName, (MediaClock) currentClock); } else { // None of the types we recognize as leaf node clock types - // recursively process child clocks. ClockGroup currentClockGroup = currentClock as ClockGroup; if (currentClockGroup != null) { ClockCollection childrenClocks = currentClockGroup.Children; for( int i = 0; i < childrenClocks.Count; i++ ) { ClockTreeWalkRecursive( childrenClocks[i], containingObject, nameScope, targetObject, currentObjectName, currentPropertyPath, handoffBehavior, clockMappings, layer); } } } }
public bool Remove(Clock clock) { if (clock == null) { throw new ArgumentNullException("clock"); } if (List.Contains(clock) == false) { return false; } List.Remove(clock); return true; }