Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / 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. /****************************************************************************\ * * 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
- sapiproxy.cs
- Events.cs
- Subtree.cs
- AssociationTypeEmitter.cs
- SerializationEventsCache.cs
- indexingfiltermarshaler.cs
- JoinGraph.cs
- ZipIOCentralDirectoryBlock.cs
- RequestSecurityTokenResponseCollection.cs
- DoubleCollectionValueSerializer.cs
- SettingsSavedEventArgs.cs
- ServiceOperationViewControl.cs
- SymmetricAlgorithm.cs
- ReturnEventArgs.cs
- Missing.cs
- FigureHelper.cs
- TypeUtils.cs
- WebPartConnectionsEventArgs.cs
- HttpRawResponse.cs
- PenLineCapValidation.cs
- DesignRelationCollection.cs
- Keywords.cs
- PeerConnector.cs
- ForceCopyBuildProvider.cs
- TreeViewCancelEvent.cs
- ConfigXmlReader.cs
- Interlocked.cs
- PathSegmentCollection.cs
- WorkflowRuntime.cs
- ConfigXmlDocument.cs
- RectAnimationUsingKeyFrames.cs
- DetailsViewDeletedEventArgs.cs
- HtmlTable.cs
- GiveFeedbackEventArgs.cs
- UserControl.cs
- CatalogZone.cs
- SourceChangedEventArgs.cs
- Matrix3DValueSerializer.cs
- TraceLevelStore.cs
- ProviderIncompatibleException.cs
- AlternateView.cs
- TypedTableBaseExtensions.cs
- BufferBuilder.cs
- TreeNodeConverter.cs
- RepeatButtonAutomationPeer.cs
- XamlToRtfParser.cs
- SignatureConfirmationElement.cs
- InvokePatternIdentifiers.cs
- securitymgrsite.cs
- TypeConstant.cs
- DirectoryNotFoundException.cs
- TakeQueryOptionExpression.cs
- XmlFormatExtensionAttribute.cs
- InputChannelBinder.cs
- EncoderParameters.cs
- Hash.cs
- DataControlField.cs
- CacheVirtualItemsEvent.cs
- DataGridViewColumnStateChangedEventArgs.cs
- ProtocolsConfiguration.cs
- ProfessionalColorTable.cs
- StatusBarPanelClickEvent.cs
- DesignerAdapterAttribute.cs
- DragDropManager.cs
- RecognizedWordUnit.cs
- DbException.cs
- View.cs
- HandledEventArgs.cs
- NotImplementedException.cs
- RIPEMD160.cs
- SamlAuthenticationStatement.cs
- CalendarDateRangeChangingEventArgs.cs
- SoapAttributeAttribute.cs
- SiteMapNode.cs
- HtmlProps.cs
- Subset.cs
- UIAgentAsyncEndRequest.cs
- SqlProvider.cs
- HttpFileCollectionWrapper.cs
- ListView.cs
- TextTreeObjectNode.cs
- ResourceDescriptionAttribute.cs
- ArrangedElement.cs
- PrintDialogDesigner.cs
- PreviousTrackingServiceAttribute.cs
- TemplateColumn.cs
- TypeInitializationException.cs
- ToolStripRenderer.cs
- WebMessageEncodingElement.cs
- CodeNamespaceCollection.cs
- OptimalBreakSession.cs
- ToolboxDataAttribute.cs
- SHA1.cs
- GeneralTransformCollection.cs
- RepeatInfo.cs
- MailWebEventProvider.cs
- ControlValuePropertyAttribute.cs
- PrtTicket_Public_Simple.cs
- PropertiesTab.cs
- XmlDataLoader.cs