Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Debugger / InstrumentationTracker.cs / 1305376 / InstrumentationTracker.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Debugger { using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.IO; using System.Runtime; // Keep track of instrumentation information. // - which subroot has source file but not yet instrumented. // - which subroots share the same source file // SubRoot is defined as an activity that has a source file // (Custom Activity). class InstrumentationTracker { // Root of the workflow to keep track. Activity root; // Mapping of subroots to their source files. DictionaryuninstrumentedSubRoots; Dictionary UninstrumentedSubRoots { get { if (this.uninstrumentedSubRoots == null) { InitializeUninstrumentedSubRoots(); } return this.uninstrumentedSubRoots; } } public InstrumentationTracker(Activity root) { this.root = root; } // Initialize UninstrumentedSubRoots by traversing the workflow. void InitializeUninstrumentedSubRoots() { this.uninstrumentedSubRoots = new Dictionary (); Queue activitiesRemaining = new Queue (); CollectSubRoot(this.root); activitiesRemaining.Enqueue(this.root); while (activitiesRemaining.Count > 0) { Activity toProcess = activitiesRemaining.Dequeue(); foreach (Activity activity in WorkflowInspectionServices.GetActivities(toProcess)) { CollectSubRoot(activity); activitiesRemaining.Enqueue(activity); } } } // Collect subroot as uninstrumented activity. void CollectSubRoot(Activity activity) { string sourcePath = XamlDebuggerXmlReader.GetFileName(activity) as string; if (!string.IsNullOrEmpty(sourcePath)) { this.uninstrumentedSubRoots.Add(activity, sourcePath); } } // Whether this is unistrumented sub root. public bool IsUninstrumentedSubRoot(Activity subRoot) { return this.UninstrumentedSubRoots.ContainsKey(subRoot); } // Returns Activities that have the same source as the given subRoot. // This will return other instantiation of the same custom activity. // Needed to avoid re-instrumentation of the same file. public List GetSameSourceSubRoots(Activity subRoot) { string sourcePath; List sameSourceSubRoots = new List (); if (this.UninstrumentedSubRoots.TryGetValue(subRoot, out sourcePath)) { foreach (KeyValuePair entry in this.UninstrumentedSubRoots) { if (entry.Value == sourcePath && entry.Key != subRoot) { sameSourceSubRoots.Add(entry.Key); } } } return sameSourceSubRoots; } // Mark this sub root as instrumented. public void MarkInstrumented(Activity subRoot) { this.UninstrumentedSubRoots.Remove(subRoot); } } } // 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
- HttpFileCollection.cs
- MenuItemStyleCollection.cs
- InvalidPropValue.cs
- CompareValidator.cs
- CultureTable.cs
- ServiceHost.cs
- WindowsRichEdit.cs
- MouseActionConverter.cs
- Help.cs
- DesignerPerfEventProvider.cs
- WriteableBitmap.cs
- SqlBooleanMismatchVisitor.cs
- ControlParameter.cs
- MediaElement.cs
- AlphaSortedEnumConverter.cs
- DLinqAssociationProvider.cs
- HttpApplicationFactory.cs
- PersonalizationStateQuery.cs
- TrackBarRenderer.cs
- PolyBezierSegment.cs
- sqlcontext.cs
- QueryOptionExpression.cs
- DependencyPropertyAttribute.cs
- _NativeSSPI.cs
- SqlFileStream.cs
- SelectionPatternIdentifiers.cs
- BindingsSection.cs
- ExternalException.cs
- MenuAdapter.cs
- ApplicationServiceHelper.cs
- ConstNode.cs
- RowBinding.cs
- ConfigurationErrorsException.cs
- JournalEntryStack.cs
- OuterGlowBitmapEffect.cs
- ClientFormsIdentity.cs
- Model3DCollection.cs
- MachineKey.cs
- EraserBehavior.cs
- IndicCharClassifier.cs
- CookielessHelper.cs
- ToolboxItemFilterAttribute.cs
- CriticalFinalizerObject.cs
- FixedSOMElement.cs
- ParserHooks.cs
- JsonQNameDataContract.cs
- ProfileInfo.cs
- ProcessHostServerConfig.cs
- PropertyMapper.cs
- MSAANativeProvider.cs
- XmlAnyElementAttributes.cs
- FileRecordSequenceHelper.cs
- MsmqBindingBase.cs
- DiscardableAttribute.cs
- SiteMapNodeItemEventArgs.cs
- BulletedList.cs
- SqlSelectStatement.cs
- QueryGeneratorBase.cs
- ExitEventArgs.cs
- WorkflowWebService.cs
- ConnectionPoolRegistry.cs
- MappingModelBuildProvider.cs
- GlyphRunDrawing.cs
- CatalogPartDesigner.cs
- XmlDomTextWriter.cs
- TextWriterTraceListener.cs
- EntitySqlException.cs
- ConstructorNeedsTagAttribute.cs
- MappedMetaModel.cs
- Point3DAnimationUsingKeyFrames.cs
- ToolStripPanelRenderEventArgs.cs
- WebExceptionStatus.cs
- Common.cs
- Transform.cs
- DataGridBoundColumn.cs
- UnwrappedTypesXmlSerializerManager.cs
- InternalRelationshipCollection.cs
- ParsedRoute.cs
- MembershipUser.cs
- FloaterBaseParagraph.cs
- control.ime.cs
- ObjectQueryExecutionPlan.cs
- XmlSchemaGroup.cs
- MD5.cs
- ArgumentOutOfRangeException.cs
- TagPrefixCollection.cs
- LayoutExceptionEventArgs.cs
- MonikerHelper.cs
- UmAlQuraCalendar.cs
- InstancePersistence.cs
- ConfigsHelper.cs
- HebrewCalendar.cs
- ConstraintEnumerator.cs
- XmlSchemaSimpleTypeRestriction.cs
- XmlDocumentSerializer.cs
- DoubleAnimationClockResource.cs
- SessionIDManager.cs
- KnownBoxes.cs
- ObjectManager.cs
- TreeViewImageIndexConverter.cs