Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Core / CSharp / System / Windows / Media / Animation / TimelineGroup.cs / 1 / TimelineGroup.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Markup;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Media.Animation
{
///
/// This class represents base class for Timelines that have functionality
/// related to having Children.
///
[ContentProperty("Children")]
public abstract partial class TimelineGroup : Timeline, IAddChild
{
#region Constructors
///
/// Creates a TimelineGroup with default properties.
///
protected TimelineGroup()
: base()
{
}
///
/// Creates a TimelineGroup with the specified BeginTime.
///
///
/// The scheduled BeginTime for this TimelineGroup.
///
protected TimelineGroup(Nullable beginTime)
: base(beginTime)
{
}
///
/// Creates a TimelineGroup with the specified begin time and duration.
///
///
/// The scheduled BeginTime for this TimelineGroup.
///
///
/// The simple Duration of this TimelineGroup.
///
protected TimelineGroup(Nullable beginTime, Duration duration)
: base(beginTime, duration)
{
}
///
/// Creates a TimelineGroup with the specified BeginTime, Duration and RepeatBehavior.
///
///
/// The scheduled BeginTime for this TimelineGroup.
///
///
/// The simple Duration of this TimelineGroup.
///
///
/// The RepeatBehavior for this TimelineGroup.
///
protected TimelineGroup(Nullable beginTime, Duration duration, RepeatBehavior repeatBehavior)
: base(beginTime, duration, repeatBehavior)
{
}
#endregion
#region Timeline
///
///
///
///
protected internal override Clock AllocateClock()
{
return new ClockGroup(this);
}
///
/// Creates a new ClockGroup using this TimelineGroup.
///
/// A new ClockGroup.
new public ClockGroup CreateClock()
{
return (ClockGroup)base.CreateClock();
}
#endregion
#region IAddChild interface
///
/// Adds a child object to this TimelineGroup.
///
///
/// The child object to add.
///
///
/// A Timeline only accepts another Timeline (or derived class) as
/// a child.
///
void IAddChild.AddChild(object child)
{
WritePreamble();
if (child == null)
{
throw new ArgumentNullException("child");
}
AddChild(child);
WritePostscript();
}
///
/// This method performs the core functionality of the AddChild()
/// method on the IAddChild interface. For a Timeline this means
/// determining adding the child parameter to the Children collection
/// if it's a Timeline.
///
///
/// This method is the only core implementation. It does not call
/// WritePreamble() or WritePostscript(). It also doesn't throw an
/// ArgumentNullException if the child parameter is null. These tasks
/// are performed by the interface implementation. Therefore, it's OK
/// for a derived class to override this method and call the base
/// class implementation only if they determine that it's the right
/// course of action. The derived class can rely on Timeline's
/// implementation of IAddChild.AddChild or implement their own
/// following the Freezable pattern since that would be a public
/// method.
///
/// An object representing the child that
/// should be added. If this is a Timeline it will be added to the
/// Children collection; otherwise an exception will be thrown.
/// The child parameter is not a
/// Timeline.
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void AddChild(object child)
{
Timeline timelineChild = child as Timeline;
if (timelineChild == null)
{
throw new ArgumentException(SR.Get(SRID.Timing_ChildMustBeTimeline), "child");
}
else
{
Children.Add(timelineChild);
}
}
///
/// Adds a text string as a child of this Timeline.
///
///
/// The text to add.
///
///
/// A Timeline does not accept text as a child, so this method will
/// raise an InvalididOperationException unless a derived class has
/// overridden the behavior to add text.
///
/// The childText parameter is
/// null.
void IAddChild.AddText(string childText)
{
WritePreamble();
if (childText == null)
{
throw new ArgumentNullException("childText");
}
AddText(childText);
WritePostscript();
}
///
/// This method performs the core functionality of the AddText()
/// method on the IAddChild interface. For a Timeline this means
/// throwing and InvalidOperationException because it doesn't
/// support adding text.
///
///
/// This method is the only core implementation. It does not call
/// WritePreamble() or WritePostscript(). It also doesn't throw an
/// ArgumentNullException if the childText parameter is null. These tasks
/// are performed by the interface implementation. Therefore, it's OK
/// for a derived class to override this method and call the base
/// class implementation only if they determine that it's the right
/// course of action. The derived class can rely on Timeline's
/// implementation of IAddChild.AddChild or implement their own
/// following the Freezable pattern since that would be a public
/// method.
///
/// A string representing the child text that
/// should be added. If this is a Timeline an exception will be
/// thrown.
/// Timelines have no way
/// of adding text.
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void AddText(string childText)
{
throw new InvalidOperationException(SR.Get(SRID.Timing_NoTextChildren));
}
#endregion // IAddChild interface
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Markup;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Media.Animation
{
///
/// This class represents base class for Timelines that have functionality
/// related to having Children.
///
[ContentProperty("Children")]
public abstract partial class TimelineGroup : Timeline, IAddChild
{
#region Constructors
///
/// Creates a TimelineGroup with default properties.
///
protected TimelineGroup()
: base()
{
}
///
/// Creates a TimelineGroup with the specified BeginTime.
///
///
/// The scheduled BeginTime for this TimelineGroup.
///
protected TimelineGroup(Nullable beginTime)
: base(beginTime)
{
}
///
/// Creates a TimelineGroup with the specified begin time and duration.
///
///
/// The scheduled BeginTime for this TimelineGroup.
///
///
/// The simple Duration of this TimelineGroup.
///
protected TimelineGroup(Nullable beginTime, Duration duration)
: base(beginTime, duration)
{
}
///
/// Creates a TimelineGroup with the specified BeginTime, Duration and RepeatBehavior.
///
///
/// The scheduled BeginTime for this TimelineGroup.
///
///
/// The simple Duration of this TimelineGroup.
///
///
/// The RepeatBehavior for this TimelineGroup.
///
protected TimelineGroup(Nullable beginTime, Duration duration, RepeatBehavior repeatBehavior)
: base(beginTime, duration, repeatBehavior)
{
}
#endregion
#region Timeline
///
///
///
///
protected internal override Clock AllocateClock()
{
return new ClockGroup(this);
}
///
/// Creates a new ClockGroup using this TimelineGroup.
///
/// A new ClockGroup.
new public ClockGroup CreateClock()
{
return (ClockGroup)base.CreateClock();
}
#endregion
#region IAddChild interface
///
/// Adds a child object to this TimelineGroup.
///
///
/// The child object to add.
///
///
/// A Timeline only accepts another Timeline (or derived class) as
/// a child.
///
void IAddChild.AddChild(object child)
{
WritePreamble();
if (child == null)
{
throw new ArgumentNullException("child");
}
AddChild(child);
WritePostscript();
}
///
/// This method performs the core functionality of the AddChild()
/// method on the IAddChild interface. For a Timeline this means
/// determining adding the child parameter to the Children collection
/// if it's a Timeline.
///
///
/// This method is the only core implementation. It does not call
/// WritePreamble() or WritePostscript(). It also doesn't throw an
/// ArgumentNullException if the child parameter is null. These tasks
/// are performed by the interface implementation. Therefore, it's OK
/// for a derived class to override this method and call the base
/// class implementation only if they determine that it's the right
/// course of action. The derived class can rely on Timeline's
/// implementation of IAddChild.AddChild or implement their own
/// following the Freezable pattern since that would be a public
/// method.
///
/// An object representing the child that
/// should be added. If this is a Timeline it will be added to the
/// Children collection; otherwise an exception will be thrown.
/// The child parameter is not a
/// Timeline.
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void AddChild(object child)
{
Timeline timelineChild = child as Timeline;
if (timelineChild == null)
{
throw new ArgumentException(SR.Get(SRID.Timing_ChildMustBeTimeline), "child");
}
else
{
Children.Add(timelineChild);
}
}
///
/// Adds a text string as a child of this Timeline.
///
///
/// The text to add.
///
///
/// A Timeline does not accept text as a child, so this method will
/// raise an InvalididOperationException unless a derived class has
/// overridden the behavior to add text.
///
/// The childText parameter is
/// null.
void IAddChild.AddText(string childText)
{
WritePreamble();
if (childText == null)
{
throw new ArgumentNullException("childText");
}
AddText(childText);
WritePostscript();
}
///
/// This method performs the core functionality of the AddText()
/// method on the IAddChild interface. For a Timeline this means
/// throwing and InvalidOperationException because it doesn't
/// support adding text.
///
///
/// This method is the only core implementation. It does not call
/// WritePreamble() or WritePostscript(). It also doesn't throw an
/// ArgumentNullException if the childText parameter is null. These tasks
/// are performed by the interface implementation. Therefore, it's OK
/// for a derived class to override this method and call the base
/// class implementation only if they determine that it's the right
/// course of action. The derived class can rely on Timeline's
/// implementation of IAddChild.AddChild or implement their own
/// following the Freezable pattern since that would be a public
/// method.
///
/// A string representing the child text that
/// should be added. If this is a Timeline an exception will be
/// thrown.
/// Timelines have no way
/// of adding text.
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void AddText(string childText)
{
throw new InvalidOperationException(SR.Get(SRID.Timing_NoTextChildren));
}
#endregion // IAddChild interface
}
}
// 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
- RectIndependentAnimationStorage.cs
- TextEncodedRawTextWriter.cs
- AbstractExpressions.cs
- QueryStringConverter.cs
- FamilyTypeface.cs
- TransportContext.cs
- UxThemeWrapper.cs
- PageAction.cs
- ReliableMessagingHelpers.cs
- ToolStripScrollButton.cs
- ViewGenerator.cs
- ToolZone.cs
- DocumentXmlWriter.cs
- SynchronizationHandlesCodeDomSerializer.cs
- BitmapEffectState.cs
- ScalarType.cs
- MasterPage.cs
- PageParserFilter.cs
- SiteOfOriginContainer.cs
- sqlstateclientmanager.cs
- XslCompiledTransform.cs
- ObjectQuery_EntitySqlExtensions.cs
- DbProviderServices.cs
- TypeReference.cs
- CodeExpressionCollection.cs
- DesignerActionHeaderItem.cs
- MessageEncodingBindingElement.cs
- SoapMessage.cs
- MatrixTransform.cs
- PageTheme.cs
- PropertyInfoSet.cs
- RotateTransform3D.cs
- NodeLabelEditEvent.cs
- GridViewRowPresenterBase.cs
- ObjectPersistData.cs
- OleDbErrorCollection.cs
- TypeInfo.cs
- ItemCheckEvent.cs
- SiteMapPath.cs
- DataListCommandEventArgs.cs
- _BufferOffsetSize.cs
- DynamicMethod.cs
- SequentialOutput.cs
- XsltCompileContext.cs
- MsdtcClusterUtils.cs
- ListViewAutomationPeer.cs
- OperationDescriptionCollection.cs
- TargetException.cs
- Camera.cs
- BitStream.cs
- TypeLibConverter.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- IResourceProvider.cs
- OwnerDrawPropertyBag.cs
- Decimal.cs
- JumpPath.cs
- XmlC14NWriter.cs
- LocalizableAttribute.cs
- AssertSection.cs
- SrgsSemanticInterpretationTag.cs
- SingleConverter.cs
- DataGridViewBand.cs
- HttpContextBase.cs
- AssemblyResourceLoader.cs
- HTMLTextWriter.cs
- COM2IPerPropertyBrowsingHandler.cs
- PropertyBuilder.cs
- QilTypeChecker.cs
- FormatSettings.cs
- BamlLocalizableResourceKey.cs
- XmlWrappingWriter.cs
- SafeRightsManagementEnvironmentHandle.cs
- SymbolTable.cs
- File.cs
- Rectangle.cs
- BufferedGraphicsManager.cs
- FixedDocumentPaginator.cs
- MetafileHeader.cs
- PartialToken.cs
- CompoundFileReference.cs
- UnmanagedMemoryStream.cs
- Int32Storage.cs
- EntityDataSourceColumn.cs
- StyleXamlParser.cs
- FamilyTypefaceCollection.cs
- XmlSchemaInclude.cs
- XamlTemplateSerializer.cs
- InvalidateEvent.cs
- Setter.cs
- ValueUtilsSmi.cs
- OptimalTextSource.cs
- Point3DCollection.cs
- FontStretchConverter.cs
- GraphicsPath.cs
- XmlAtomicValue.cs
- SystemIPGlobalStatistics.cs
- ImageListImageEditor.cs
- ProxyElement.cs
- InstallerTypeAttribute.cs
- Publisher.cs