Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / System / Windows / Media / RenderDataDrawingContext.cs / 1 / RenderDataDrawingContext.cs
//------------------------------------------------------------------------------
// Microsoft Avalon
// Copyright (c) Microsoft Corporation, 2003
//
// File: RenderDataDrawingContext.cs
//
// History:
// GSchneid: 04/19/2003
// Created it based on the RenderDataDrawingContext used in the AvPhat branch.
// adsmith: 07/02/2003
// Renamed to RenderDataDrawingContext, which derives from DrawingContext
// adsmith: 07/02/2003
// Renamed to RenderDataDrawingContext, which derives from DrawingContext
// This class no longer understand Visuals, and simply produces RenderData.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Security.Permissions;
using System.Windows;
using System.Windows.Threading;
using System.Windows.Media.Animation;
using System.Windows.Media;
using System.Windows.Media.Composition;
using System.Diagnostics;
using MS.Internal;
using System.Security;
//-----------------------------------------------------------------------------
// This section lists various things that we could improve on the DrawingContxt
// class.
//
// - Remove the isAnimated flag from being propagated everywhere. Rather mark
// the pail when we add an animated argument.
//-----------------------------------------------------------------------------
namespace System.Windows.Media
{
///
/// Drawing context.
///
internal partial class RenderDataDrawingContext : DrawingContext, IDisposable
{
#region Constructors
///
/// Creates a drawing context which is associated with a given Dispatcher
///
internal RenderDataDrawingContext()
{
}
#endregion Constructors
#region Public Methods
internal RenderData GetRenderData()
{
return _renderData;
}
///
/// Closes the DrawingContext and flushes the content.
/// Afterwards the DrawingContext can not be used anymore.
/// This call does not require all Push calls to have been Popped.
///
///
/// This call is illegal if this object has already been closed or disposed.
///
public override void Close()
{
VerifyApiNonstructuralChange();
((IDisposable)this).Dispose();
}
///
/// This is the same as the Close call:
/// Closes the DrawingContext and flushes the content.
/// Afterwards the DrawingContext can not be used anymore.
/// This call does not require all Push calls to have been Popped.
///
///
/// This call is illegal if this object has already been closed or disposed.
///
protected override void DisposeCore()
{
if (!_disposed)
{
EnsureCorrectNesting();
CloseCore(_renderData);
_disposed = true;
}
}
#endregion Public Methods
#region Protected Methods
///
/// CloseCore - Implemented be derivees to Close the context.
/// This will only be called once (if ever) per instance.
///
/// The render data produced by this RenderDataDrawingContext.
protected virtual void CloseCore(RenderData renderData) {}
#endregion Protected Methods
#region Private Methods
///
/// EnsureRenderData - this method ensures that the _renderData variable is initialized.
/// The render data's _buffer will be lazily instantiated via the Draw* methods which all
/// call WriteDataRecord.
///
private void EnsureRenderData()
{
if (_renderData == null)
{
_renderData = new RenderData();
}
}
///
/// This verifies that the API can be called for access which doesn't affect structure.
///
protected override void VerifyApiNonstructuralChange()
{
base.VerifyApiNonstructuralChange();
if (_disposed)
{
throw new ObjectDisposedException("RenderDataDrawingContext");
}
}
///
/// This method checks if there were any Push calls that were not matched by
/// the corresponding Pop. If this is the case, this method adds corresponding
/// number of Pop instructions to the render data.
///
private void EnsureCorrectNesting()
{
if (_renderData != null && _stackDepth > 0)
{
int stackDepth = _stackDepth;
for (int i = 0; i < stackDepth; i++)
{
Pop();
}
}
_stackDepth = 0;
}
#endregion Private Methods
#region Fields
private RenderData _renderData;
private bool _disposed;
private int _stackDepth;
#endregion Fields
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
// Microsoft Avalon
// Copyright (c) Microsoft Corporation, 2003
//
// File: RenderDataDrawingContext.cs
//
// History:
// GSchneid: 04/19/2003
// Created it based on the RenderDataDrawingContext used in the AvPhat branch.
// adsmith: 07/02/2003
// Renamed to RenderDataDrawingContext, which derives from DrawingContext
// adsmith: 07/02/2003
// Renamed to RenderDataDrawingContext, which derives from DrawingContext
// This class no longer understand Visuals, and simply produces RenderData.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Security.Permissions;
using System.Windows;
using System.Windows.Threading;
using System.Windows.Media.Animation;
using System.Windows.Media;
using System.Windows.Media.Composition;
using System.Diagnostics;
using MS.Internal;
using System.Security;
//-----------------------------------------------------------------------------
// This section lists various things that we could improve on the DrawingContxt
// class.
//
// - Remove the isAnimated flag from being propagated everywhere. Rather mark
// the pail when we add an animated argument.
//-----------------------------------------------------------------------------
namespace System.Windows.Media
{
///
/// Drawing context.
///
internal partial class RenderDataDrawingContext : DrawingContext, IDisposable
{
#region Constructors
///
/// Creates a drawing context which is associated with a given Dispatcher
///
internal RenderDataDrawingContext()
{
}
#endregion Constructors
#region Public Methods
internal RenderData GetRenderData()
{
return _renderData;
}
///
/// Closes the DrawingContext and flushes the content.
/// Afterwards the DrawingContext can not be used anymore.
/// This call does not require all Push calls to have been Popped.
///
///
/// This call is illegal if this object has already been closed or disposed.
///
public override void Close()
{
VerifyApiNonstructuralChange();
((IDisposable)this).Dispose();
}
///
/// This is the same as the Close call:
/// Closes the DrawingContext and flushes the content.
/// Afterwards the DrawingContext can not be used anymore.
/// This call does not require all Push calls to have been Popped.
///
///
/// This call is illegal if this object has already been closed or disposed.
///
protected override void DisposeCore()
{
if (!_disposed)
{
EnsureCorrectNesting();
CloseCore(_renderData);
_disposed = true;
}
}
#endregion Public Methods
#region Protected Methods
///
/// CloseCore - Implemented be derivees to Close the context.
/// This will only be called once (if ever) per instance.
///
/// The render data produced by this RenderDataDrawingContext.
protected virtual void CloseCore(RenderData renderData) {}
#endregion Protected Methods
#region Private Methods
///
/// EnsureRenderData - this method ensures that the _renderData variable is initialized.
/// The render data's _buffer will be lazily instantiated via the Draw* methods which all
/// call WriteDataRecord.
///
private void EnsureRenderData()
{
if (_renderData == null)
{
_renderData = new RenderData();
}
}
///
/// This verifies that the API can be called for access which doesn't affect structure.
///
protected override void VerifyApiNonstructuralChange()
{
base.VerifyApiNonstructuralChange();
if (_disposed)
{
throw new ObjectDisposedException("RenderDataDrawingContext");
}
}
///
/// This method checks if there were any Push calls that were not matched by
/// the corresponding Pop. If this is the case, this method adds corresponding
/// number of Pop instructions to the render data.
///
private void EnsureCorrectNesting()
{
if (_renderData != null && _stackDepth > 0)
{
int stackDepth = _stackDepth;
for (int i = 0; i < stackDepth; i++)
{
Pop();
}
}
_stackDepth = 0;
}
#endregion Private Methods
#region Fields
private RenderData _renderData;
private bool _disposed;
private int _stackDepth;
#endregion Fields
}
}
// 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
- PolicyStatement.cs
- LZCodec.cs
- WrappedIUnknown.cs
- Bidi.cs
- UnaryOperationBinder.cs
- AttachedPropertyInfo.cs
- _FtpDataStream.cs
- UDPClient.cs
- EntitySqlQueryBuilder.cs
- ReceiveMessageAndVerifySecurityAsyncResultBase.cs
- MenuItemStyle.cs
- ConfigPathUtility.cs
- MultilineStringEditor.cs
- DataGridrowEditEndingEventArgs.cs
- FactorySettingsElement.cs
- TemplateBaseAction.cs
- BufferedGraphics.cs
- TableHeaderCell.cs
- QueryGenerator.cs
- ObjectDataSourceEventArgs.cs
- base64Transforms.cs
- ClientConvert.cs
- TagPrefixInfo.cs
- GenericIdentity.cs
- ContextMenu.cs
- Logging.cs
- ObjectQueryProvider.cs
- ReverseInheritProperty.cs
- WebPartTransformerCollection.cs
- OletxTransactionManager.cs
- RequestFactory.cs
- SchemaComplexType.cs
- StreamingContext.cs
- Condition.cs
- EarlyBoundInfo.cs
- TableDetailsCollection.cs
- FilteredDataSetHelper.cs
- HtmlInputText.cs
- GridViewRowCollection.cs
- MessagePropertyAttribute.cs
- ObjectListShowCommandsEventArgs.cs
- SerializerProvider.cs
- DataGridSortCommandEventArgs.cs
- WebPartEditorOkVerb.cs
- connectionpool.cs
- SimpleTextLine.cs
- ValidationSummary.cs
- DataGridBoolColumn.cs
- BodyWriter.cs
- CollectionViewGroupInternal.cs
- TextDecoration.cs
- PageBuildProvider.cs
- CredentialManagerDialog.cs
- StandardBindingImporter.cs
- XPathNodePointer.cs
- TextDecoration.cs
- XPathScanner.cs
- UserControlBuildProvider.cs
- CFGGrammar.cs
- SqlConnectionManager.cs
- StreamReader.cs
- _SecureChannel.cs
- SQLBytesStorage.cs
- RegexInterpreter.cs
- WSFederationHttpBindingElement.cs
- CodePageEncoding.cs
- FrameSecurityDescriptor.cs
- HighlightComponent.cs
- StreamInfo.cs
- UserPreferenceChangingEventArgs.cs
- PreviewPrintController.cs
- MTConfigUtil.cs
- DetailsViewRowCollection.cs
- EntryPointNotFoundException.cs
- XmlDataDocument.cs
- Double.cs
- Int32RectConverter.cs
- ScrollContentPresenter.cs
- Point3DAnimationBase.cs
- Shape.cs
- ColumnReorderedEventArgs.cs
- FormParameter.cs
- InputScopeNameConverter.cs
- PersonalizableAttribute.cs
- ImageMapEventArgs.cs
- ManifestResourceInfo.cs
- QuotedPrintableStream.cs
- TextTreeNode.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- TableNameAttribute.cs
- SAPICategories.cs
- StandardMenuStripVerb.cs
- DataBinding.cs
- WorkflowDesignerMessageFilter.cs
- ColumnBinding.cs
- login.cs
- LiteralLink.cs
- VectorAnimationBase.cs
- DataKeyArray.cs
- SelectionItemProviderWrapper.cs