Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebControls / HotSpotCollection.cs / 1 / HotSpotCollection.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing.Design;
using System.Web.UI;
using System.Security.Permissions;
namespace System.Web.UI.WebControls {
///
/// Collection of HotSpots.
///
[
Editor("System.Web.UI.Design.WebControls.HotSpotCollectionEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor))
]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class HotSpotCollection : StateManagedCollection {
private static readonly Type[] knownTypes = new Type[] {
typeof(CircleHotSpot),
typeof(RectangleHotSpot),
typeof(PolygonHotSpot),
};
///
/// Returns the HotSpot at a given index.
///
public HotSpot this[int index] {
get {
return (HotSpot)((IList)this)[index];
}
}
///
/// Adds a HotSpot to the collection.
///
public int Add(HotSpot spot) {
return ((IList)this).Add(spot);
}
///
/// Creates a known type of HotSpot.
///
protected override object CreateKnownType(int index) {
switch (index) {
case 0:
return new CircleHotSpot();
case 1:
return new RectangleHotSpot();
case 2:
return new PolygonHotSpot();
default:
throw new ArgumentOutOfRangeException(SR.GetString(SR.HotSpotCollection_InvalidTypeIndex));
}
}
///
/// Returns an ArrayList of known HotSpot types.
///
protected override Type[] GetKnownTypes() {
return knownTypes;
}
///
/// Inserts a HotSpot into the collection.
///
public void Insert(int index, HotSpot spot) {
((IList)this).Insert(index, spot);
}
///
/// Validates that an object is a HotSpot.
///
protected override void OnValidate(object o) {
base.OnValidate(o);
if (!(o is HotSpot))
throw new ArgumentException(SR.GetString(SR.HotSpotCollection_InvalidType));
}
///
/// Removes a HotSpot from the collection.
///
public void Remove(HotSpot spot) {
((IList)this).Remove(spot);
}
///
/// Removes a HotSpot from the collection at a given index.
///
public void RemoveAt(int index) {
((IList)this).RemoveAt(index);
}
///
/// Marks a HotSpot as dirty so that it will record its entire state into view state.
///
protected override void SetDirtyObject(object o) {
((HotSpot)o).SetDirty();
}
}
}
// 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;
using System.Collections;
using System.ComponentModel;
using System.Drawing.Design;
using System.Web.UI;
using System.Security.Permissions;
namespace System.Web.UI.WebControls {
///
/// Collection of HotSpots.
///
[
Editor("System.Web.UI.Design.WebControls.HotSpotCollectionEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor))
]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class HotSpotCollection : StateManagedCollection {
private static readonly Type[] knownTypes = new Type[] {
typeof(CircleHotSpot),
typeof(RectangleHotSpot),
typeof(PolygonHotSpot),
};
///
/// Returns the HotSpot at a given index.
///
public HotSpot this[int index] {
get {
return (HotSpot)((IList)this)[index];
}
}
///
/// Adds a HotSpot to the collection.
///
public int Add(HotSpot spot) {
return ((IList)this).Add(spot);
}
///
/// Creates a known type of HotSpot.
///
protected override object CreateKnownType(int index) {
switch (index) {
case 0:
return new CircleHotSpot();
case 1:
return new RectangleHotSpot();
case 2:
return new PolygonHotSpot();
default:
throw new ArgumentOutOfRangeException(SR.GetString(SR.HotSpotCollection_InvalidTypeIndex));
}
}
///
/// Returns an ArrayList of known HotSpot types.
///
protected override Type[] GetKnownTypes() {
return knownTypes;
}
///
/// Inserts a HotSpot into the collection.
///
public void Insert(int index, HotSpot spot) {
((IList)this).Insert(index, spot);
}
///
/// Validates that an object is a HotSpot.
///
protected override void OnValidate(object o) {
base.OnValidate(o);
if (!(o is HotSpot))
throw new ArgumentException(SR.GetString(SR.HotSpotCollection_InvalidType));
}
///
/// Removes a HotSpot from the collection.
///
public void Remove(HotSpot spot) {
((IList)this).Remove(spot);
}
///
/// Removes a HotSpot from the collection at a given index.
///
public void RemoveAt(int index) {
((IList)this).RemoveAt(index);
}
///
/// Marks a HotSpot as dirty so that it will record its entire state into view state.
///
protected override void SetDirtyObject(object o) {
((HotSpot)o).SetDirty();
}
}
}
// 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
- FileNotFoundException.cs
- SingleResultAttribute.cs
- WpfSharedBamlSchemaContext.cs
- SafeIUnknown.cs
- RelationshipEndCollection.cs
- HtmlPhoneCallAdapter.cs
- WarningException.cs
- DataContractSerializerOperationFormatter.cs
- StrokeDescriptor.cs
- ToolBar.cs
- ScriptBehaviorDescriptor.cs
- AbstractSvcMapFileLoader.cs
- KnownIds.cs
- UTF8Encoding.cs
- DragDeltaEventArgs.cs
- TemplateBamlRecordReader.cs
- SqlServices.cs
- Point3DConverter.cs
- CommonObjectSecurity.cs
- ResourcesChangeInfo.cs
- OdbcConnectionFactory.cs
- Transform3DGroup.cs
- BitmapFrame.cs
- WebSysDefaultValueAttribute.cs
- SignatureToken.cs
- ZipIOCentralDirectoryFileHeader.cs
- ChangeBlockUndoRecord.cs
- GroupQuery.cs
- Wrapper.cs
- TextSchema.cs
- PreservationFileWriter.cs
- MatcherBuilder.cs
- DirectoryNotFoundException.cs
- PackWebRequestFactory.cs
- MenuItem.cs
- XmlDictionary.cs
- Attributes.cs
- SQLGuidStorage.cs
- RetriableClipboard.cs
- DataMisalignedException.cs
- MouseDevice.cs
- SqlProviderServices.cs
- SqlErrorCollection.cs
- IndentedWriter.cs
- Identity.cs
- Utils.cs
- RunWorkerCompletedEventArgs.cs
- LinqDataSourceContextData.cs
- RoleManagerSection.cs
- ClientFormsAuthenticationMembershipProvider.cs
- ExpandCollapseProviderWrapper.cs
- ResourcesChangeInfo.cs
- SiteMapPath.cs
- DesignerAutoFormatStyle.cs
- GifBitmapDecoder.cs
- CallbackWrapper.cs
- SplineKeyFrames.cs
- DataGridClipboardHelper.cs
- FirstMatchCodeGroup.cs
- Verify.cs
- StoreItemCollection.cs
- ObjectPropertyMapping.cs
- SafeCryptoHandles.cs
- TableLayoutStyleCollection.cs
- WeakReferenceEnumerator.cs
- PathData.cs
- CriticalExceptions.cs
- GridViewSelectEventArgs.cs
- _NegoStream.cs
- COAUTHIDENTITY.cs
- DefaultHttpHandler.cs
- DotNetATv1WindowsLogEntryDeserializer.cs
- AlternateViewCollection.cs
- CommonXSendMessage.cs
- ConstraintManager.cs
- ClientFormsAuthenticationCredentials.cs
- LifetimeServices.cs
- DynamicControl.cs
- XmlEncoding.cs
- XmlSerializer.cs
- CompressedStack.cs
- ListBoxItem.cs
- CultureMapper.cs
- NTAccount.cs
- oledbmetadatacolumnnames.cs
- CodeTypeReferenceExpression.cs
- AttachmentService.cs
- PeerName.cs
- WorkflowView.cs
- SerializableAttribute.cs
- DiscoveryDocumentLinksPattern.cs
- ClientData.cs
- DependencyPropertyKind.cs
- DuplicateWaitObjectException.cs
- AutomationPropertyInfo.cs
- PackageRelationshipSelector.cs
- StackOverflowException.cs
- _BufferOffsetSize.cs
- SystemThemeKey.cs
- SettingsContext.cs