Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Controls / PageRanges.cs / 1 / PageRanges.cs
/*++
Copyright (C) 2004 - 2005 Microsoft Corporation.
All rights reserved.
Module Name:
PageRanges.cs
Abstract:
This file contains the implementation of the PageRange class
and the PageRangeSelection enum for page range support in the
dialog.
Author:
Robert Anderson (robertan) 9-May-2005
--*/
using System;
using System.Globalization;
using System.Windows;
namespace System.Windows.Controls
{
///
/// Enumeration of values for page range options.
///
public enum PageRangeSelection
{
///
/// All pages are printed.
///
AllPages,
///
/// A set of user defined pages are printed.
///
UserPages
}
///
/// This class defines one single page range from
/// a start page to an end page.
///
public struct PageRange
{
#region Constructors
///
/// Constructs an instance of PageRange with one specified page.
///
///
/// Single page of this page range.
///
public
PageRange(
int page
)
{
_pageFrom = page;
_pageTo = page;
}
///
/// Constructs an instance of PageRange with specified values.
///
///
/// Starting page of this range.
///
///
/// Ending page of this range.
///
public
PageRange(
int pageFrom,
int pageTo
)
{
_pageFrom = pageFrom;
_pageTo = pageTo;
}
#endregion Constructors
#region Public properties
///
/// Gets or sets the start page of the page range.
///
public int PageFrom
{
get
{
return _pageFrom;
}
set
{
_pageFrom = value;
}
}
///
/// Gets of sets the end page of the page range.
///
public int PageTo
{
get
{
return _pageTo;
}
set
{
_pageTo = value;
}
}
#endregion Public properties
#region Private data
private
int _pageFrom;
private
int _pageTo;
#endregion Private data
#region Override methods
///
/// Converts this PageRange structure to its string representation.
///
///
/// A string value containing the range.
///
public
override
string
ToString(
)
{
string rangeText;
if (_pageTo != _pageFrom)
{
rangeText = String.Format(CultureInfo.InvariantCulture, SR.Get(SRID.PrintDialogPageRange), _pageFrom, _pageTo);
}
else
{
rangeText = _pageFrom.ToString(CultureInfo.InvariantCulture);
}
return rangeText;
}
///
/// Tests equality between this instance and the specified object.
///
///
/// The object to compare this instance to.
///
///
/// True if obj is equal to this object, else false.
/// Returns false if obj is not of type PageRange.
///
public
override
bool
Equals(
object obj
)
{
if (obj == null || obj.GetType() != typeof(PageRange))
{
return false;
}
return Equals((PageRange) obj);
}
///
/// Tests equality between this instance and the specified page range.
///
///
/// The page range to compare this instance to.
///
///
/// True if the page range is equal to this object, else false.
///
public
bool
Equals(
PageRange pageRange
)
{
return (pageRange.PageFrom == this.PageFrom) && (pageRange.PageTo == this.PageTo);
}
///
/// Calculates a hash code for this PageRange.
///
///
/// Returns an integer hashcode for this instance.
///
public
override
int
GetHashCode()
{
return base.GetHashCode();
}
///
/// Test for equality.
///
public
static
bool
operator ==(
PageRange pr1,
PageRange pr2
)
{
return pr1.Equals(pr2);
}
///
/// Test for inequality.
///
public
static
bool
operator !=(
PageRange pr1,
PageRange pr2
)
{
return !(pr1.Equals(pr2));
}
#endregion Override methods
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
/*++
Copyright (C) 2004 - 2005 Microsoft Corporation.
All rights reserved.
Module Name:
PageRanges.cs
Abstract:
This file contains the implementation of the PageRange class
and the PageRangeSelection enum for page range support in the
dialog.
Author:
Robert Anderson (robertan) 9-May-2005
--*/
using System;
using System.Globalization;
using System.Windows;
namespace System.Windows.Controls
{
///
/// Enumeration of values for page range options.
///
public enum PageRangeSelection
{
///
/// All pages are printed.
///
AllPages,
///
/// A set of user defined pages are printed.
///
UserPages
}
///
/// This class defines one single page range from
/// a start page to an end page.
///
public struct PageRange
{
#region Constructors
///
/// Constructs an instance of PageRange with one specified page.
///
///
/// Single page of this page range.
///
public
PageRange(
int page
)
{
_pageFrom = page;
_pageTo = page;
}
///
/// Constructs an instance of PageRange with specified values.
///
///
/// Starting page of this range.
///
///
/// Ending page of this range.
///
public
PageRange(
int pageFrom,
int pageTo
)
{
_pageFrom = pageFrom;
_pageTo = pageTo;
}
#endregion Constructors
#region Public properties
///
/// Gets or sets the start page of the page range.
///
public int PageFrom
{
get
{
return _pageFrom;
}
set
{
_pageFrom = value;
}
}
///
/// Gets of sets the end page of the page range.
///
public int PageTo
{
get
{
return _pageTo;
}
set
{
_pageTo = value;
}
}
#endregion Public properties
#region Private data
private
int _pageFrom;
private
int _pageTo;
#endregion Private data
#region Override methods
///
/// Converts this PageRange structure to its string representation.
///
///
/// A string value containing the range.
///
public
override
string
ToString(
)
{
string rangeText;
if (_pageTo != _pageFrom)
{
rangeText = String.Format(CultureInfo.InvariantCulture, SR.Get(SRID.PrintDialogPageRange), _pageFrom, _pageTo);
}
else
{
rangeText = _pageFrom.ToString(CultureInfo.InvariantCulture);
}
return rangeText;
}
///
/// Tests equality between this instance and the specified object.
///
///
/// The object to compare this instance to.
///
///
/// True if obj is equal to this object, else false.
/// Returns false if obj is not of type PageRange.
///
public
override
bool
Equals(
object obj
)
{
if (obj == null || obj.GetType() != typeof(PageRange))
{
return false;
}
return Equals((PageRange) obj);
}
///
/// Tests equality between this instance and the specified page range.
///
///
/// The page range to compare this instance to.
///
///
/// True if the page range is equal to this object, else false.
///
public
bool
Equals(
PageRange pageRange
)
{
return (pageRange.PageFrom == this.PageFrom) && (pageRange.PageTo == this.PageTo);
}
///
/// Calculates a hash code for this PageRange.
///
///
/// Returns an integer hashcode for this instance.
///
public
override
int
GetHashCode()
{
return base.GetHashCode();
}
///
/// Test for equality.
///
public
static
bool
operator ==(
PageRange pr1,
PageRange pr2
)
{
return pr1.Equals(pr2);
}
///
/// Test for inequality.
///
public
static
bool
operator !=(
PageRange pr1,
PageRange pr2
)
{
return !(pr1.Equals(pr2));
}
#endregion Override methods
}
}
// 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
- TagNameToTypeMapper.cs
- COM2ExtendedUITypeEditor.cs
- Sql8ConformanceChecker.cs
- RegexMatch.cs
- RegistryDataKey.cs
- TimeStampChecker.cs
- LateBoundBitmapDecoder.cs
- AsyncCompletedEventArgs.cs
- cookiecollection.cs
- ViewStateException.cs
- XmlSchemaImporter.cs
- TextTreeUndoUnit.cs
- XmlSchemaElement.cs
- GlyphingCache.cs
- LogicalExpressionEditor.cs
- GeneralTransform3DTo2DTo3D.cs
- CompensatableTransactionScopeActivity.cs
- BindingList.cs
- DataGridViewRowsAddedEventArgs.cs
- PassportIdentity.cs
- AnnotationHighlightLayer.cs
- DataGridViewButtonColumn.cs
- ConfigurationUtility.cs
- _BaseOverlappedAsyncResult.cs
- XmlImplementation.cs
- DataTemplate.cs
- DecimalConstantAttribute.cs
- BooleanFacetDescriptionElement.cs
- FixedFlowMap.cs
- FixedDSBuilder.cs
- PropertyGridView.cs
- InternalMappingException.cs
- TriggerAction.cs
- TreeNodeStyle.cs
- ArraySet.cs
- ObjectReferenceStack.cs
- CriticalFinalizerObject.cs
- IdentifierCreationService.cs
- WindowsGraphicsCacheManager.cs
- ConnectionProviderAttribute.cs
- LineBreak.cs
- WindowProviderWrapper.cs
- ConfigViewGenerator.cs
- IISMapPath.cs
- XmlAttributes.cs
- SafeSecurityHandles.cs
- EntityClientCacheKey.cs
- Terminate.cs
- SystemNetworkInterface.cs
- SuppressMessageAttribute.cs
- TabRenderer.cs
- SchemaDeclBase.cs
- ContentDisposition.cs
- SslStream.cs
- CommandManager.cs
- CookieHandler.cs
- ReadOnlyCollection.cs
- ErrorActivity.cs
- DesignerGenericWebPart.cs
- CallbackValidator.cs
- ResourceDescriptionAttribute.cs
- MdImport.cs
- ProcessHostServerConfig.cs
- returneventsaver.cs
- WindowsScrollBar.cs
- ComplexTypeEmitter.cs
- Table.cs
- ScrollItemProviderWrapper.cs
- PeerFlooder.cs
- InstanceKeyView.cs
- KeyMatchBuilder.cs
- DataSourceView.cs
- SelectionEditingBehavior.cs
- SHA512Managed.cs
- dataprotectionpermissionattribute.cs
- RangeValuePattern.cs
- StringInfo.cs
- Tablet.cs
- SchemaImporter.cs
- LogAppendAsyncResult.cs
- ToolboxItemAttribute.cs
- MonitoringDescriptionAttribute.cs
- ReadOnlyDataSource.cs
- XmlQueryCardinality.cs
- IDispatchConstantAttribute.cs
- GridViewSelectEventArgs.cs
- BookmarkCallbackWrapper.cs
- _LoggingObject.cs
- Literal.cs
- VirtualDirectoryMappingCollection.cs
- BrowsableAttribute.cs
- StructuredProperty.cs
- SqlCacheDependencyDatabase.cs
- ColumnCollection.cs
- DecimalConstantAttribute.cs
- LocationUpdates.cs
- XmlIlGenerator.cs
- _FtpControlStream.cs
- Activity.cs
- ConstantSlot.cs