Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Runtime / MappableObjectManager.cs / 1305376 / MappableObjectManager.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.Runtime { using System.Activities.Hosting; using System.Collections.Generic; using System.Globalization; using System.Runtime; using System.Runtime.Serialization; using System.Xml.Linq; [DataContract] class MappableObjectManager { [DataMember(EmitDefaultValue = false)] ListmappableLocations; public MappableObjectManager() { } public int Count { get { int result = 0; if (this.mappableLocations != null) { result += this.mappableLocations.Count; } return result; } } public IDictionary GatherMappableVariables() { Dictionary result = null; if (this.mappableLocations != null && this.mappableLocations.Count > 0) { result = new Dictionary (this.mappableLocations.Count); for (int locationIndex = 0; locationIndex < this.mappableLocations.Count; locationIndex++) { MappableLocation mappableLocation = this.mappableLocations[locationIndex]; result.Add(mappableLocation.MappingKeyName, new LocationInfo(mappableLocation.Name, mappableLocation.OwnerDisplayName, mappableLocation.Location.Value)); } } return result; } public void Register(Location location, Activity activity, LocationReference locationOwner, ActivityInstance activityInstance) { Fx.Assert(location.CanBeMapped, "should only register mappable locations"); if (this.mappableLocations == null) { this.mappableLocations = new List (); } this.mappableLocations.Add(new MappableLocation(locationOwner, activity, activityInstance, location)); } public void Unregister(Location location) { Fx.Assert(location.CanBeMapped, "should only register mappable locations"); int mappedLocationsCount = this.mappableLocations.Count; for (int i = 0; i < mappedLocationsCount; i++) { if (object.ReferenceEquals(this.mappableLocations[i].Location, location)) { this.mappableLocations.RemoveAt(i); break; } } Fx.Assert(this.mappableLocations.Count == mappedLocationsCount - 1, "can only unregister locations that have been registered"); } [DataContract] class MappableLocation { public MappableLocation(LocationReference locationOwner, Activity activity, ActivityInstance activityInstance, Location location) { this.Name = locationOwner.Name; this.OwnerDisplayName = activity.DisplayName; this.Location = location; this.MappingKeyName = string.Format(CultureInfo.InvariantCulture, "activity.{0}-{1}_{2}", activity.Id, locationOwner.Id, activityInstance.Id); } [DataMember] internal string MappingKeyName { get; private set; } [DataMember] public string Name { get; private set; } [DataMember(EmitDefaultValue = false)] public string OwnerDisplayName { get; private set; } [DataMember] internal Location Location { get; private set; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StreamInfo.cs
- RectIndependentAnimationStorage.cs
- ClientWindowsAuthenticationMembershipProvider.cs
- ConfigXmlDocument.cs
- diagnosticsswitches.cs
- PolicyLevel.cs
- IisTraceWebEventProvider.cs
- CompositeDataBoundControl.cs
- MenuCommand.cs
- SystemDropShadowChrome.cs
- COM2PropertyPageUITypeConverter.cs
- NumericUpDownAcceleration.cs
- EventPropertyMap.cs
- DataGridViewMethods.cs
- PropertyRecord.cs
- HandlerWithFactory.cs
- WorkflowPageSetupDialog.cs
- EventSourceCreationData.cs
- JpegBitmapEncoder.cs
- SamlAuthenticationStatement.cs
- CustomLineCap.cs
- UnsafeNativeMethodsTablet.cs
- EndpointAddress.cs
- columnmapkeybuilder.cs
- BitmapSizeOptions.cs
- SendActivity.cs
- DbUpdateCommandTree.cs
- Attributes.cs
- UniqueEventHelper.cs
- ConfigurationErrorsException.cs
- AppDomain.cs
- PackageFilter.cs
- RsaKeyGen.cs
- SpellerError.cs
- COSERVERINFO.cs
- DynamicDocumentPaginator.cs
- TraceHandler.cs
- HttpEncoder.cs
- DataPagerFieldCollection.cs
- TileBrush.cs
- WrappedKeySecurityTokenParameters.cs
- EntityCommandExecutionException.cs
- ProfileGroupSettings.cs
- TransactionManager.cs
- TableItemStyle.cs
- XslAstAnalyzer.cs
- AttachedAnnotation.cs
- FacetEnabledSchemaElement.cs
- GenericIdentity.cs
- CodeTypeReferenceCollection.cs
- XD.cs
- MatrixStack.cs
- OutputCacheSection.cs
- CroppedBitmap.cs
- userdatakeys.cs
- TextElementAutomationPeer.cs
- FormsIdentity.cs
- DefaultHttpHandler.cs
- StrongNameKeyPair.cs
- ToolStripLocationCancelEventArgs.cs
- HMACRIPEMD160.cs
- ParserStreamGeometryContext.cs
- SimpleBitVector32.cs
- AccessDataSource.cs
- ConnectionsZone.cs
- IntegerValidatorAttribute.cs
- SettingsPropertyWrongTypeException.cs
- ReferenceConverter.cs
- XsltOutput.cs
- TreeIterator.cs
- WebExceptionStatus.cs
- DynamicValidatorEventArgs.cs
- XmlFormatReaderGenerator.cs
- EventBuilder.cs
- MoveSizeWinEventHandler.cs
- WeakReferenceKey.cs
- XsltLoader.cs
- Int64AnimationBase.cs
- ExceptionHelpers.cs
- UserUseLicenseDictionaryLoader.cs
- CannotUnloadAppDomainException.cs
- EventProxy.cs
- BufferedWebEventProvider.cs
- Point3DAnimationUsingKeyFrames.cs
- MultiBinding.cs
- CodeEntryPointMethod.cs
- ToolStripDropDownClosedEventArgs.cs
- PriorityRange.cs
- RoleManagerSection.cs
- ITextView.cs
- VisualBasicDesignerHelper.cs
- ComponentChangedEvent.cs
- EpmCustomContentDeSerializer.cs
- MobileListItemCollection.cs
- GeneralTransform3DGroup.cs
- KernelTypeValidation.cs
- HitTestParameters.cs
- _ProxyChain.cs
- Track.cs
- SubstitutionDesigner.cs