Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / Media / Animation / ClockController.cs / 1 / ClockController.cs
//------------------------------------------------------------------------------ // Microsoft Windows Client Platform // Copyright (c) Microsoft Corporation, 2004 // // File: ClockController.cs //----------------------------------------------------------------------------- using MS.Internal; using MS.Utility; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Runtime.InteropServices; using System.Windows.Threading; using System.Windows; using System.Windows.Media.Composition; using System.Windows.Markup; using SR=MS.Internal.PresentationCore.SR; using SRID=MS.Internal.PresentationCore.SRID; namespace System.Windows.Media.Animation { ////// Provides access to interactive methods for a given Clock. /// public sealed class ClockController : DispatcherObject { #region Data private Clock _owner; #endregion // Data #region Constructors ////// Creates an instance of ClockController. /// /// /// The Clock that owns this collection. /// internal ClockController(Clock owner) { Debug.Assert(owner != null, "ClockController must have a non-null owner."); _owner = owner; } #endregion // Constructors #region Methods ////// Schedules a begin at the next tick. /// ////// // Internally, Begin works similarly to Seek, in that it preschedules a seek in // the Clock to the zero position. public void Begin() { _owner.InternalBegin(); } ///If the Clock is not enabled then this method has no effect.
/// ///This method has no effect on the timing tree until the next time /// a tick is processed. As a side-effect, the appropriate events will also /// not be raised until then.
////// Moves this clock to the end of its active period and then performs /// whatever behavior is specified by the FillBehavior property. /// ////// // Internally, SkipToFill works similarly to Seek, in that it preschedules a seek in // the Clock to the Fill position. public void SkipToFill() { _owner.InternalSkipToFill(); } ///This method only has an effect if the Clock's CurrentState is ClockState.Active.
///This method has no effect on the timing tree until the next time /// a tick is processed. As a side-effect, the appropriate events will also /// not be raised until then.
////// Pauses the Clock and its children. /// ////// ///This method stops this Clock from moving. As a side effect, /// the Clocks's children are also paused. The Clock remains /// paused until one of the following events take place:
//////
/// ///- /// The Clock is allowed to continue with a call to the ///
///method. /// - /// The Clock is restarted or ended with a call to the ///
///or methods. /// - /// The Clock is restarted due to a scheduled begin time. ///
///- /// The Clock is removed from the timing tree. ///
///This method has no effect if the Clock is not active, or is currently paused.
///public void Pause() { _owner.InternalPause(); } /// /// Allows a Clock to progress again after a call to ///. /// /// ///Resuming a Clock also automatically resumes all of the Clock's children.
/// ///This method has no effect if the Clock is not active and in the paused /// state. In addition, only a Clock that was previously explicitly paused with /// a call to
/// ///can be resumed with this method. For more details, see the remarks for the
////// method. public void Resume() { _owner.InternalResume(); } /// /// Seeks a Clock to a new position. /// /// /// The seek offset, measured in the Clock's simple time frame of /// reference. The meaning of this parameter depends on the value of the origin parameter. /// /// /// The meaning of the offset parameter. See theenumeration /// for possible values. /// /// /// public void Seek(TimeSpan offset, TimeSeekOrigin origin) { // IF YOU CHANGE THIS CODE: // This code is very similar to that in SeekAlignedToLastTick and is duplicated // in each method so that exceptions will be thrown from the public // method the user has called. You probably need to change both methods. if (!TimeEnumHelper.IsValidTimeSeekOrigin(origin)) { throw new InvalidEnumArgumentException(SR.Get(SRID.Enum_Invalid, "TimeSeekOrigin")); } if (origin == TimeSeekOrigin.Duration) { Duration duration = _owner.ResolvedDuration; if (!duration.HasTimeSpan) { // Can't seek relative to the Duration if it has been specified as Forever or if // it has not yet been resolved. throw new InvalidOperationException(SR.Get(SRID.Timing_SeekDestinationIndefinite)); } else { offset = offset + duration.TimeSpan; } } // Any offset greater than zero is OK here. If it's past the effective // duration it means execute the FillBehavior. if (offset < TimeSpan.Zero) { throw new InvalidOperationException(SR.Get(SRID.Timing_SeekDestinationNegative)); } _owner.InternalSeek(offset); } ///If the Clock is a container, its children's Clocks are also updated accordingly.
/// ///The seek is measured in the Clock's simple time frame of reference, meaning that the /// actual wall-clock playback time skipped (or replayed) may be different than that specified /// by the offset parameter, if time manipulations from the Speed, Acceleration or Deceleration /// properties are in effect for this Clock.
/// ///The seek operation may only span the current simple duration of the Clock. Seeking to a /// time earlier than the begin time positions the Clock at the begin point, whereas /// seeking beyond the end simply puts the Clock at the end point.
////// Process all information that occured until now /// public void SeekAlignedToLastTick(TimeSpan offset, TimeSeekOrigin origin) { // IF YOU CHANGE THIS CODE: // This code is very similar to that in Seek and is duplicated // in each method so that exceptions will be thrown from the public // method the user has called. You probably need to change both methods. if (!TimeEnumHelper.IsValidTimeSeekOrigin(origin)) { throw new InvalidEnumArgumentException(SR.Get(SRID.Enum_Invalid, "TimeSeekOrigin")); } if (origin == TimeSeekOrigin.Duration) { Duration duration = _owner.ResolvedDuration; if (!duration.HasTimeSpan) { // Can't seek relative to the Duration if it has been specified as Forevor or if // it has not yet been resolved. throw new InvalidOperationException(SR.Get(SRID.Timing_SeekDestinationIndefinite)); } else { offset = offset + duration.TimeSpan; } } // Any offset greater than zero is OK here. If it's past the effective // duration it means execute the FillBehavior. if (offset < TimeSpan.Zero) { throw new InvalidOperationException(SR.Get(SRID.Timing_SeekDestinationNegative)); } _owner.InternalSeekAlignedToLastTick(offset); } ////// Interactively stops the Clock. /// ////// This takes the Clock out of its active or fill period and leaves it /// in the off state. It may be reactivated with an interactive Begin(). /// public void Stop() { _owner.InternalStop(); } ////// Interactively moves the Clock into a Completed state, fires Remove event. /// ////// This takes the Clock out of its active or fill period and leaves it /// in the off state. It may be reactivated with an interactive Begin(). /// public void Remove() { _owner.InternalRemove(); } #endregion // Methods #region Properties ////// Returns the Clock controlled by this ClockController class. /// public Clock Clock { get { return _owner; } } ////// Returns or sets the interactive speed for the Clock. /// public double SpeedRatio { get { return _owner.InternalGetSpeedRatio(); } set { if (value < 0 || value > double.MaxValue || double.IsNaN(value)) { throw new ArgumentException(SR.Get(SRID.Timing_InvalidArgFinitePositive), "value"); } _owner.InternalSetSpeedRatio(value); } } #endregion // Properties } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ // Microsoft Windows Client Platform // Copyright (c) Microsoft Corporation, 2004 // // File: ClockController.cs //----------------------------------------------------------------------------- using MS.Internal; using MS.Utility; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Runtime.InteropServices; using System.Windows.Threading; using System.Windows; using System.Windows.Media.Composition; using System.Windows.Markup; using SR=MS.Internal.PresentationCore.SR; using SRID=MS.Internal.PresentationCore.SRID; namespace System.Windows.Media.Animation { ////// Provides access to interactive methods for a given Clock. /// public sealed class ClockController : DispatcherObject { #region Data private Clock _owner; #endregion // Data #region Constructors ////// Creates an instance of ClockController. /// /// /// The Clock that owns this collection. /// internal ClockController(Clock owner) { Debug.Assert(owner != null, "ClockController must have a non-null owner."); _owner = owner; } #endregion // Constructors #region Methods ////// Schedules a begin at the next tick. /// ////// // Internally, Begin works similarly to Seek, in that it preschedules a seek in // the Clock to the zero position. public void Begin() { _owner.InternalBegin(); } ///If the Clock is not enabled then this method has no effect.
/// ///This method has no effect on the timing tree until the next time /// a tick is processed. As a side-effect, the appropriate events will also /// not be raised until then.
////// Moves this clock to the end of its active period and then performs /// whatever behavior is specified by the FillBehavior property. /// ////// // Internally, SkipToFill works similarly to Seek, in that it preschedules a seek in // the Clock to the Fill position. public void SkipToFill() { _owner.InternalSkipToFill(); } ///This method only has an effect if the Clock's CurrentState is ClockState.Active.
///This method has no effect on the timing tree until the next time /// a tick is processed. As a side-effect, the appropriate events will also /// not be raised until then.
////// Pauses the Clock and its children. /// ////// ///This method stops this Clock from moving. As a side effect, /// the Clocks's children are also paused. The Clock remains /// paused until one of the following events take place:
//////
/// ///- /// The Clock is allowed to continue with a call to the ///
///method. /// - /// The Clock is restarted or ended with a call to the ///
///or methods. /// - /// The Clock is restarted due to a scheduled begin time. ///
///- /// The Clock is removed from the timing tree. ///
///This method has no effect if the Clock is not active, or is currently paused.
///public void Pause() { _owner.InternalPause(); } /// /// Allows a Clock to progress again after a call to ///. /// /// ///Resuming a Clock also automatically resumes all of the Clock's children.
/// ///This method has no effect if the Clock is not active and in the paused /// state. In addition, only a Clock that was previously explicitly paused with /// a call to
/// ///can be resumed with this method. For more details, see the remarks for the
////// method. public void Resume() { _owner.InternalResume(); } /// /// Seeks a Clock to a new position. /// /// /// The seek offset, measured in the Clock's simple time frame of /// reference. The meaning of this parameter depends on the value of the origin parameter. /// /// /// The meaning of the offset parameter. See theenumeration /// for possible values. /// /// /// public void Seek(TimeSpan offset, TimeSeekOrigin origin) { // IF YOU CHANGE THIS CODE: // This code is very similar to that in SeekAlignedToLastTick and is duplicated // in each method so that exceptions will be thrown from the public // method the user has called. You probably need to change both methods. if (!TimeEnumHelper.IsValidTimeSeekOrigin(origin)) { throw new InvalidEnumArgumentException(SR.Get(SRID.Enum_Invalid, "TimeSeekOrigin")); } if (origin == TimeSeekOrigin.Duration) { Duration duration = _owner.ResolvedDuration; if (!duration.HasTimeSpan) { // Can't seek relative to the Duration if it has been specified as Forever or if // it has not yet been resolved. throw new InvalidOperationException(SR.Get(SRID.Timing_SeekDestinationIndefinite)); } else { offset = offset + duration.TimeSpan; } } // Any offset greater than zero is OK here. If it's past the effective // duration it means execute the FillBehavior. if (offset < TimeSpan.Zero) { throw new InvalidOperationException(SR.Get(SRID.Timing_SeekDestinationNegative)); } _owner.InternalSeek(offset); } ///If the Clock is a container, its children's Clocks are also updated accordingly.
/// ///The seek is measured in the Clock's simple time frame of reference, meaning that the /// actual wall-clock playback time skipped (or replayed) may be different than that specified /// by the offset parameter, if time manipulations from the Speed, Acceleration or Deceleration /// properties are in effect for this Clock.
/// ///The seek operation may only span the current simple duration of the Clock. Seeking to a /// time earlier than the begin time positions the Clock at the begin point, whereas /// seeking beyond the end simply puts the Clock at the end point.
////// Process all information that occured until now /// public void SeekAlignedToLastTick(TimeSpan offset, TimeSeekOrigin origin) { // IF YOU CHANGE THIS CODE: // This code is very similar to that in Seek and is duplicated // in each method so that exceptions will be thrown from the public // method the user has called. You probably need to change both methods. if (!TimeEnumHelper.IsValidTimeSeekOrigin(origin)) { throw new InvalidEnumArgumentException(SR.Get(SRID.Enum_Invalid, "TimeSeekOrigin")); } if (origin == TimeSeekOrigin.Duration) { Duration duration = _owner.ResolvedDuration; if (!duration.HasTimeSpan) { // Can't seek relative to the Duration if it has been specified as Forevor or if // it has not yet been resolved. throw new InvalidOperationException(SR.Get(SRID.Timing_SeekDestinationIndefinite)); } else { offset = offset + duration.TimeSpan; } } // Any offset greater than zero is OK here. If it's past the effective // duration it means execute the FillBehavior. if (offset < TimeSpan.Zero) { throw new InvalidOperationException(SR.Get(SRID.Timing_SeekDestinationNegative)); } _owner.InternalSeekAlignedToLastTick(offset); } ////// Interactively stops the Clock. /// ////// This takes the Clock out of its active or fill period and leaves it /// in the off state. It may be reactivated with an interactive Begin(). /// public void Stop() { _owner.InternalStop(); } ////// Interactively moves the Clock into a Completed state, fires Remove event. /// ////// This takes the Clock out of its active or fill period and leaves it /// in the off state. It may be reactivated with an interactive Begin(). /// public void Remove() { _owner.InternalRemove(); } #endregion // Methods #region Properties ////// Returns the Clock controlled by this ClockController class. /// public Clock Clock { get { return _owner; } } ////// Returns or sets the interactive speed for the Clock. /// public double SpeedRatio { get { return _owner.InternalGetSpeedRatio(); } set { if (value < 0 || value > double.MaxValue || double.IsNaN(value)) { throw new ArgumentException(SR.Get(SRID.Timing_InvalidArgFinitePositive), "value"); } _owner.InternalSetSpeedRatio(value); } } #endregion // Properties } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- _ShellExpression.cs
- PathBox.cs
- ListViewInsertionMark.cs
- KeyMatchBuilder.cs
- COM2EnumConverter.cs
- NegatedConstant.cs
- RectIndependentAnimationStorage.cs
- OperatorExpressions.cs
- HtmlTableCellCollection.cs
- UnionCodeGroup.cs
- AvTraceDetails.cs
- ListMarkerSourceInfo.cs
- ImmutableCommunicationTimeouts.cs
- SourceElementsCollection.cs
- storepermission.cs
- GradientStop.cs
- DisposableCollectionWrapper.cs
- XmlILTrace.cs
- DataGridViewColumnCollection.cs
- ModelItemImpl.cs
- TypeTypeConverter.cs
- DbParameterHelper.cs
- HtmlElement.cs
- DesignerActionList.cs
- MarkupCompilePass1.cs
- TextTabProperties.cs
- DurableServiceAttribute.cs
- ScriptingWebServicesSectionGroup.cs
- XPathDocumentIterator.cs
- NativeMethods.cs
- HashAlgorithm.cs
- SafeLocalMemHandle.cs
- MergeFilterQuery.cs
- AssemblyInfo.cs
- LicenseContext.cs
- ChangeBlockUndoRecord.cs
- odbcmetadatacollectionnames.cs
- DataGridViewControlCollection.cs
- SafeNativeMethods.cs
- AesManaged.cs
- GorillaCodec.cs
- RegularExpressionValidator.cs
- ParseNumbers.cs
- WindowsTooltip.cs
- RuleEngine.cs
- IDataContractSurrogate.cs
- XmlSchemaExporter.cs
- ProvideValueServiceProvider.cs
- Serializer.cs
- Rotation3D.cs
- ColorConvertedBitmap.cs
- EmptyArray.cs
- selecteditemcollection.cs
- Site.cs
- _AutoWebProxyScriptHelper.cs
- EditableLabelControl.cs
- ToolStripButton.cs
- XmlAtomicValue.cs
- UnmanagedMemoryStream.cs
- BaseDataBoundControl.cs
- VSWCFServiceContractGenerator.cs
- MyContact.cs
- TreeNodeBindingDepthConverter.cs
- Parser.cs
- OutgoingWebRequestContext.cs
- SqlUserDefinedAggregateAttribute.cs
- NullReferenceException.cs
- StatementContext.cs
- JavaScriptObjectDeserializer.cs
- SelectionList.cs
- DbMetaDataFactory.cs
- QueryRewriter.cs
- HostSecurityManager.cs
- SectionInput.cs
- MenuItemCollection.cs
- MembershipSection.cs
- DiagnosticTraceSchemas.cs
- SpellerHighlightLayer.cs
- ProgressPage.cs
- BindingMemberInfo.cs
- HttpDictionary.cs
- BuildManagerHost.cs
- ArcSegment.cs
- XmlSchemaExternal.cs
- GenericPrincipal.cs
- WorkflowViewElement.cs
- TypeConverterAttribute.cs
- ActiveDesignSurfaceEvent.cs
- Grant.cs
- SequenceDesigner.cs
- CodeObjectCreateExpression.cs
- RuntimeConfigurationRecord.cs
- QilInvoke.cs
- RegexMatchCollection.cs
- InlineUIContainer.cs
- httpstaticobjectscollection.cs
- OutputCacheSettingsSection.cs
- CodeSubDirectoriesCollection.cs
- SelectionPattern.cs
- SafeNativeMethods.cs