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
- URLAttribute.cs
- BaseComponentEditor.cs
- RsaSecurityKey.cs
- ComponentConverter.cs
- CharacterMetrics.cs
- OdbcEnvironmentHandle.cs
- CursorEditor.cs
- ReadOnlyNameValueCollection.cs
- Wizard.cs
- ExeConfigurationFileMap.cs
- Function.cs
- XPathNavigator.cs
- NGCPageContentSerializerAsync.cs
- PropagatorResult.cs
- XmlSchemaComplexContentRestriction.cs
- WorkflowStateRollbackService.cs
- HtmlProps.cs
- SynchronizedPool.cs
- BitmapEffectInputData.cs
- XmlTextAttribute.cs
- AssemblyCache.cs
- SourceItem.cs
- Timeline.cs
- ProxyWebPartManager.cs
- HttpProfileBase.cs
- XmlMapping.cs
- DataGridColumnCollection.cs
- HttpApplication.cs
- Wildcard.cs
- Qualifier.cs
- Stylesheet.cs
- pingexception.cs
- ChannelServices.cs
- ConnectionPoint.cs
- XmlChildNodes.cs
- PrtTicket_Public_Simple.cs
- SafeEventLogWriteHandle.cs
- XComponentModel.cs
- IndexingContentUnit.cs
- FixedSOMSemanticBox.cs
- VisualStateChangedEventArgs.cs
- TextElementEnumerator.cs
- PropertyConverter.cs
- WorkflowExecutor.cs
- BamlMapTable.cs
- BuiltInExpr.cs
- ValueQuery.cs
- SqlParameterizer.cs
- RuleSetDialog.cs
- TrustLevelCollection.cs
- ZipIOFileItemStream.cs
- PasswordDeriveBytes.cs
- SecurityState.cs
- PolyLineSegment.cs
- IDictionary.cs
- WinEventQueueItem.cs
- DataObjectEventArgs.cs
- UnsettableComboBox.cs
- Compiler.cs
- DeclarativeCatalogPart.cs
- HotSpotCollection.cs
- Sorting.cs
- DrawingCollection.cs
- Activator.cs
- ShapeTypeface.cs
- ThreadExceptionDialog.cs
- ServiceHostFactory.cs
- SafeBitVector32.cs
- UIElementHelper.cs
- CompareValidator.cs
- WmlPhoneCallAdapter.cs
- Label.cs
- TemplateManager.cs
- QilLoop.cs
- ExpressionEditorAttribute.cs
- Int32AnimationBase.cs
- XhtmlConformanceSection.cs
- StringComparer.cs
- ConfigXmlReader.cs
- DateTimeOffsetConverter.cs
- SQLDateTimeStorage.cs
- listviewsubitemcollectioneditor.cs
- EDesignUtil.cs
- _AcceptOverlappedAsyncResult.cs
- ContainerSelectorGlyph.cs
- Pointer.cs
- OutputCacheSettingsSection.cs
- TextLineResult.cs
- SecurityContext.cs
- VisualTreeUtils.cs
- ISAPIApplicationHost.cs
- Int32KeyFrameCollection.cs
- TypeForwardedToAttribute.cs
- IImplicitResourceProvider.cs
- PolyQuadraticBezierSegment.cs
- EventLogPermissionEntry.cs
- HierarchicalDataSourceControl.cs
- AppDomain.cs
- SqlTransaction.cs
- PartManifestEntry.cs