Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Media / Animation / SeekStoryboard.cs / 1 / SeekStoryboard.cs
/****************************************************************************\
*
* File: SeekStoryboard.cs
*
* This object includes a Storyboard reference. When triggered, the Storyboard
* seeks to the given offset.
*
* Copyright (C) by Microsoft Corporation. All rights reserved.
*
\***************************************************************************/
using System.ComponentModel; // DefaultValueAttribute
using System.Diagnostics; // Debug.Assert
namespace System.Windows.Media.Animation
{
///
/// SeekStoryboard will call seek on its Storyboard reference when
/// it is triggered.
///
public sealed class SeekStoryboard : ControllableStoryboardAction
{
///
/// A time offset to use for this action. If it is never explicitly
/// specified, it will be zero.
///
// [DefaultValue(TimeSpan.Zero)] - not usable because TimeSpan.Zero is not a constant expression.
public TimeSpan Offset
{
get
{
return _offset;
}
set
{
if (IsSealed)
{
throw new InvalidOperationException(SR.Get(SRID.CannotChangeAfterSealed, "SeekStoryboard"));
}
// TimeSpan is a struct and can't be null - hence no ArgumentNullException check.
_offset = value;
}
}
///
/// This method is used by TypeDescriptor to determine if this property should
/// be serialized.
///
// Because we can't use [DefaultValue(TimeSpan.Zero)] - TimeSpan.Zero is not a constant expression.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ShouldSerializeOffset()
{
return !(TimeSpan.Zero.Equals(_offset));
}
///
/// A time offset origin from which to evaluate the Offset value.
/// If it is never explicitly specified, it will be relative to the
/// beginning. ("Begin")
///
[DefaultValue(TimeSeekOrigin.BeginTime)]
public TimeSeekOrigin Origin
{
get
{
return _origin;
}
set
{
if (IsSealed)
{
throw new InvalidOperationException(SR.Get(SRID.CannotChangeAfterSealed, "SeekStoryboard"));
}
if( value == TimeSeekOrigin.BeginTime || value == TimeSeekOrigin.Duration ) // FxCop doesn't like Enum.IsDefined, probably need some central validation mechanism.
{
_origin = value;
}
else
{
throw new ArgumentException(SR.Get(SRID.Storyboard_UnrecognizedTimeSeekOrigin));
}
}
}
///
/// Called when it's time to execute this storyboard action
///
internal override void Invoke( FrameworkElement containingFE, FrameworkContentElement containingFCE, Storyboard storyboard )
{
Debug.Assert( containingFE != null || containingFCE != null,
"Caller of internal function failed to verify that we have a FE or FCE - we have neither." );
if( containingFE != null )
{
storyboard.Seek(containingFE, Offset, Origin);
}
else
{
storyboard.Seek(containingFCE, Offset, Origin);
}
}
TimeSpan _offset = TimeSpan.Zero;
TimeSeekOrigin _origin = TimeSeekOrigin.BeginTime;
}
}
// 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
- MessageDecoder.cs
- Pkcs9Attribute.cs
- FontNamesConverter.cs
- PaintEvent.cs
- HybridDictionary.cs
- XmlBinaryReader.cs
- WmpBitmapEncoder.cs
- DependencyObjectPropertyDescriptor.cs
- FreezableDefaultValueFactory.cs
- SafeLibraryHandle.cs
- ServiceDescriptionSerializer.cs
- GridLength.cs
- SingleResultAttribute.cs
- CharacterHit.cs
- XD.cs
- XmlImplementation.cs
- ObjectManager.cs
- SqlError.cs
- ClockGroup.cs
- ResourceContainer.cs
- TextSearch.cs
- SqlConnectionFactory.cs
- BitmapEffect.cs
- ControlIdConverter.cs
- _OSSOCK.cs
- DirectoryNotFoundException.cs
- Hyperlink.cs
- CompilerWrapper.cs
- DetailsViewInsertedEventArgs.cs
- OlePropertyStructs.cs
- SqlCaseSimplifier.cs
- CheckBoxFlatAdapter.cs
- XPathNavigatorReader.cs
- StringExpressionSet.cs
- HtmlInputButton.cs
- Package.cs
- Vector3DKeyFrameCollection.cs
- EdmValidator.cs
- GraphicsPathIterator.cs
- EncodingDataItem.cs
- MsmqIntegrationBinding.cs
- Registry.cs
- ScriptReference.cs
- MappingModelBuildProvider.cs
- FacetDescription.cs
- _Rfc2616CacheValidators.cs
- TransportConfigurationTypeElementCollection.cs
- WebPartExportVerb.cs
- codemethodreferenceexpression.cs
- ParseChildrenAsPropertiesAttribute.cs
- RegistryKey.cs
- SafeNativeMethods.cs
- EditorPartChrome.cs
- PropertyFilter.cs
- ImageList.cs
- SecurityImpersonationBehavior.cs
- InstanceStore.cs
- InstancePersistence.cs
- NativeRightsManagementAPIsStructures.cs
- WindowsRegion.cs
- RuleProcessor.cs
- AttributeAction.cs
- COAUTHIDENTITY.cs
- CmsInterop.cs
- InputGestureCollection.cs
- MultipartContentParser.cs
- RowCache.cs
- OdbcParameter.cs
- Math.cs
- BoolExpressionVisitors.cs
- Metadata.cs
- SymbolMethod.cs
- BrushMappingModeValidation.cs
- MessageEnumerator.cs
- SqlGatherProducedAliases.cs
- IndexedString.cs
- MemoryFailPoint.cs
- HMACSHA1.cs
- ZoneLinkButton.cs
- SamlAssertionKeyIdentifierClause.cs
- ActivityTypeDesigner.xaml.cs
- TextSchema.cs
- listitem.cs
- RecognitionResult.cs
- WindowsPen.cs
- SqlHelper.cs
- ClientBuildManager.cs
- FixUp.cs
- Dump.cs
- SplitterPanel.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- XmlSerializerFactory.cs
- RectKeyFrameCollection.cs
- WindowsListViewGroupHelper.cs
- ToolStripItemEventArgs.cs
- MappedMetaModel.cs
- WriteableBitmap.cs
- ScriptResourceInfo.cs
- Attributes.cs
- BufferedGraphicsContext.cs