Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / Automation / Peers / DocumentPageViewAutomationPeer.cs / 1 / DocumentPageViewAutomationPeer.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// File: DocumentPageViewAutomationPeer.cs
//
// Description: AutomationPeer associated with DocumentPageView.
//
//---------------------------------------------------------------------------
using System.Collections.Generic; // List
using System.Globalization; // CultureInfo
using System.Windows.Controls; // DocumentViewer
using System.Windows.Controls.Primitives; // DocumentPageView
namespace System.Windows.Automation.Peers
{
///
/// AutomationPeer associated with DocumentPageView.
///
public class DocumentPageViewAutomationPeer : FrameworkElementAutomationPeer
{
///
/// Constructor.
///
/// Owner of the AutomationPeer.
public DocumentPageViewAutomationPeer(DocumentPageView owner)
: base(owner)
{}
///
///
///
///
/// AutomationPeer associated with DocumentPageView blocks any exposure
/// of the currently hosted page. So it returns empty collection of children.
///
protected override List GetChildrenCore()
{
return null;
}
///
///
///
/// A string representing the current DocumentPageView.
protected override string GetAutomationIdCore()
{
// Initialize the result to Empty, so that if Name is not set on the
// DocumentPageView, and there is no valid PageNumber set, then the
// AutomationId will remain blank to avoid duplicate entries.
string result = string.Empty;
DocumentPageView owner = (DocumentPageView)Owner;
// Check if a Name is already set on the DocumentPageView, otherwise attempt
// to construct one.
if (!string.IsNullOrEmpty(owner.Name))
{
result = owner.Name;
}
else if ((owner.PageNumber >= 0) && (owner.PageNumber < int.MaxValue))
{
// This will set the AutomationId to a string that represents the current
// page number, i.e. "DocumentPage1" will represent the first page. These numbers
// will be kept in a 1-indexed format. InvariantCulture is used to ensure
// that these AutomationIds will not change with the language, so that they
// can be trusted to always work in automation.
result = String.Format(CultureInfo.InvariantCulture, "DocumentPage{0}", owner.PageNumber + 1);
}
return result;
}
}
}
// 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.
//
// File: DocumentPageViewAutomationPeer.cs
//
// Description: AutomationPeer associated with DocumentPageView.
//
//---------------------------------------------------------------------------
using System.Collections.Generic; // List
using System.Globalization; // CultureInfo
using System.Windows.Controls; // DocumentViewer
using System.Windows.Controls.Primitives; // DocumentPageView
namespace System.Windows.Automation.Peers
{
///
/// AutomationPeer associated with DocumentPageView.
///
public class DocumentPageViewAutomationPeer : FrameworkElementAutomationPeer
{
///
/// Constructor.
///
/// Owner of the AutomationPeer.
public DocumentPageViewAutomationPeer(DocumentPageView owner)
: base(owner)
{}
///
///
///
///
/// AutomationPeer associated with DocumentPageView blocks any exposure
/// of the currently hosted page. So it returns empty collection of children.
///
protected override List GetChildrenCore()
{
return null;
}
///
///
///
/// A string representing the current DocumentPageView.
protected override string GetAutomationIdCore()
{
// Initialize the result to Empty, so that if Name is not set on the
// DocumentPageView, and there is no valid PageNumber set, then the
// AutomationId will remain blank to avoid duplicate entries.
string result = string.Empty;
DocumentPageView owner = (DocumentPageView)Owner;
// Check if a Name is already set on the DocumentPageView, otherwise attempt
// to construct one.
if (!string.IsNullOrEmpty(owner.Name))
{
result = owner.Name;
}
else if ((owner.PageNumber >= 0) && (owner.PageNumber < int.MaxValue))
{
// This will set the AutomationId to a string that represents the current
// page number, i.e. "DocumentPage1" will represent the first page. These numbers
// will be kept in a 1-indexed format. InvariantCulture is used to ensure
// that these AutomationIds will not change with the language, so that they
// can be trusted to always work in automation.
result = String.Format(CultureInfo.InvariantCulture, "DocumentPage{0}", owner.PageNumber + 1);
}
return result;
}
}
}
// 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
- MdiWindowListItemConverter.cs
- SamlAssertionDirectKeyIdentifierClause.cs
- EntityContainerEntitySetDefiningQuery.cs
- IsolatedStoragePermission.cs
- WindowsAltTab.cs
- RootContext.cs
- RegexCompiler.cs
- EndOfStreamException.cs
- FixedTextPointer.cs
- LicenseContext.cs
- ContentPosition.cs
- exports.cs
- XmlSchemaFacet.cs
- BamlLocalizationDictionary.cs
- DbConnectionPoolOptions.cs
- Queue.cs
- BufferedReadStream.cs
- DesignerActionPropertyItem.cs
- TextRange.cs
- InputLanguageEventArgs.cs
- RectIndependentAnimationStorage.cs
- PerfService.cs
- HttpHandlersInstallComponent.cs
- ResourceDisplayNameAttribute.cs
- ExpressionVisitorHelpers.cs
- TypeExtension.cs
- MediaElement.cs
- WebResourceAttribute.cs
- DataServiceExpressionVisitor.cs
- SafeUserTokenHandle.cs
- PropertyToken.cs
- HtmlWindowCollection.cs
- ScalarConstant.cs
- FullTextState.cs
- DSASignatureFormatter.cs
- Viewport2DVisual3D.cs
- ServiceEndpointElementCollection.cs
- ComponentEditorForm.cs
- TypefaceCollection.cs
- PointF.cs
- DataGrid.cs
- ButtonPopupAdapter.cs
- ConfigurationException.cs
- WSFederationHttpSecurityElement.cs
- DetailsViewInsertEventArgs.cs
- XPathNodeList.cs
- PropertyValueUIItem.cs
- IPEndPointCollection.cs
- EditingScopeUndoUnit.cs
- SelectionProcessor.cs
- ThreadPool.cs
- PerfCounters.cs
- XmlSchemaValidationException.cs
- CustomLineCap.cs
- ContainerParaClient.cs
- TransactionTable.cs
- HotSpotCollection.cs
- XmlILStorageConverter.cs
- PerformanceCounterPermissionEntryCollection.cs
- StoragePropertyMapping.cs
- HttpListenerPrefixCollection.cs
- JournalNavigationScope.cs
- RectAnimationBase.cs
- AssociationSet.cs
- CompositeFontFamily.cs
- ColorInterpolationModeValidation.cs
- _SslSessionsCache.cs
- TrailingSpaceComparer.cs
- Accessible.cs
- CompositeActivityCodeGenerator.cs
- ProxyWebPartManager.cs
- StaticExtension.cs
- ContextStack.cs
- _Semaphore.cs
- RijndaelCryptoServiceProvider.cs
- ActivityCodeDomReferenceService.cs
- TextRenderingModeValidation.cs
- ChannelParameterCollection.cs
- XmlDeclaration.cs
- DesignerAdapterAttribute.cs
- XPathSelectionIterator.cs
- FrameAutomationPeer.cs
- TileBrush.cs
- DoubleConverter.cs
- EdmValidator.cs
- XmlNullResolver.cs
- StyleCollection.cs
- LOSFormatter.cs
- XamlPointCollectionSerializer.cs
- MethodBuilderInstantiation.cs
- DesignerProperties.cs
- WebControlParameterProxy.cs
- FacetDescriptionElement.cs
- DependencyObjectPropertyDescriptor.cs
- DecimalStorage.cs
- Pkcs9Attribute.cs
- InheritanceAttribute.cs
- FaultImportOptions.cs
- XmlnsDictionary.cs
- OdbcInfoMessageEvent.cs