Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Diagnostics / Eventing / Reader / EventTask.cs / 1305376 / EventTask.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: EventTask ** ** Purpose: ** This public class describes the metadata for a specific Task ** defined by a Provider. An instance of this class is obtained ** from a ProviderMetadata object. ** ============================================================*/ using System.Collections.Generic; namespace System.Diagnostics.Eventing.Reader { ////// Describes the metadata for a specific Task defined by a Provider. /// An instance of this class is obtained from a ProviderMetadata object. /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class EventTask { private int value; private string name; private string displayName; private Guid guid; private bool dataReady; ProviderMetadata pmReference; object syncObject; //called from EventMetadata internal EventTask(int value, ProviderMetadata pmReference) { this.value = value; this.pmReference = pmReference; this.syncObject = new object(); } //called from ProviderMetadata internal EventTask(string name, int value, string displayName, Guid guid) { this.value = value; this.name = name; this.displayName = displayName; this.guid = guid; this.dataReady = true; this.syncObject = new object(); } internal void PrepareData() { lock (syncObject) { if (dataReady == true) return; IEnumerableresult = pmReference.Tasks; this.name = null; this.displayName = null; this.guid = Guid.Empty; this.dataReady = true; foreach (EventTask task in result) { if (task.Value == this.value) { this.name = task.Name; this.displayName = task.DisplayName; this.guid = task.EventGuid; this.dataReady = true; break; } } } } public string Name { get { PrepareData(); return this.name; } } public int Value { get { return this.value; } } public string DisplayName { get { PrepareData(); return this.displayName; } } public Guid EventGuid { get { PrepareData(); return this.guid; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: EventTask ** ** Purpose: ** This public class describes the metadata for a specific Task ** defined by a Provider. An instance of this class is obtained ** from a ProviderMetadata object. ** ============================================================*/ using System.Collections.Generic; namespace System.Diagnostics.Eventing.Reader { /// /// Describes the metadata for a specific Task defined by a Provider. /// An instance of this class is obtained from a ProviderMetadata object. /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class EventTask { private int value; private string name; private string displayName; private Guid guid; private bool dataReady; ProviderMetadata pmReference; object syncObject; //called from EventMetadata internal EventTask(int value, ProviderMetadata pmReference) { this.value = value; this.pmReference = pmReference; this.syncObject = new object(); } //called from ProviderMetadata internal EventTask(string name, int value, string displayName, Guid guid) { this.value = value; this.name = name; this.displayName = displayName; this.guid = guid; this.dataReady = true; this.syncObject = new object(); } internal void PrepareData() { lock (syncObject) { if (dataReady == true) return; IEnumerableresult = pmReference.Tasks; this.name = null; this.displayName = null; this.guid = Guid.Empty; this.dataReady = true; foreach (EventTask task in result) { if (task.Value == this.value) { this.name = task.Name; this.displayName = task.DisplayName; this.guid = task.EventGuid; this.dataReady = true; break; } } } } public string Name { get { PrepareData(); return this.name; } } public int Value { get { return this.value; } } public string DisplayName { get { PrepareData(); return this.displayName; } } public Guid EventGuid { get { PrepareData(); return this.guid; } } } } // 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
- ServiceOperationParameter.cs
- AnonymousIdentificationSection.cs
- MethodCallExpression.cs
- DriveNotFoundException.cs
- XmlSchemaGroupRef.cs
- ConditionCollection.cs
- Tuple.cs
- DbConnectionPoolCounters.cs
- EntityDataSourceSelectedEventArgs.cs
- Exceptions.cs
- StorageConditionPropertyMapping.cs
- Light.cs
- NamedObject.cs
- TextPointerBase.cs
- CodeAttributeDeclarationCollection.cs
- DataSourceCacheDurationConverter.cs
- CodeDelegateInvokeExpression.cs
- StateFinalizationActivity.cs
- OperationDescription.cs
- SqlBooleanizer.cs
- GcSettings.cs
- ErrorLog.cs
- SqlVisitor.cs
- HtmlButton.cs
- XmlElementElement.cs
- AssemblyInfo.cs
- RequiredAttributeAttribute.cs
- CursorInteropHelper.cs
- ServiceHttpHandlerFactory.cs
- MimeXmlReflector.cs
- DoWhile.cs
- PathBox.cs
- DbConnectionStringBuilder.cs
- TypedReference.cs
- ViewService.cs
- FamilyMap.cs
- PersonalizationState.cs
- Knowncolors.cs
- BadImageFormatException.cs
- WebBrowserDesigner.cs
- LineServicesCallbacks.cs
- ByteAnimationUsingKeyFrames.cs
- FaultContractAttribute.cs
- IndicFontClient.cs
- DataServiceQueryOfT.cs
- LineInfo.cs
- CFStream.cs
- InstanceCreationEditor.cs
- RelatedPropertyManager.cs
- PatternMatchRules.cs
- GregorianCalendarHelper.cs
- ObjectConverter.cs
- SecurityElement.cs
- AssemblyHash.cs
- MetadataCache.cs
- SelfIssuedAuthRSACryptoProvider.cs
- DataSourceProvider.cs
- UdpTransportBindingElement.cs
- PersonalizationStateQuery.cs
- PenThread.cs
- DataGridItemEventArgs.cs
- EventRouteFactory.cs
- CodeAttributeArgument.cs
- _SingleItemRequestCache.cs
- PropertyTabAttribute.cs
- ComAdminInterfaces.cs
- CookieProtection.cs
- ZipIOExtraField.cs
- PeerCollaborationPermission.cs
- TemplateXamlParser.cs
- BitSet.cs
- DiagnosticTrace.cs
- LayoutInformation.cs
- SplitterPanel.cs
- PointCollectionValueSerializer.cs
- PanelStyle.cs
- QilFactory.cs
- SQLMembershipProvider.cs
- ManualResetEvent.cs
- PeerNameRecordCollection.cs
- TheQuery.cs
- DataListItemCollection.cs
- RequestNavigateEventArgs.cs
- WebConfigurationManager.cs
- CollectionViewProxy.cs
- AstNode.cs
- WeakKeyDictionary.cs
- SortAction.cs
- BuildProviderCollection.cs
- SecurityProtocol.cs
- SchemaMapping.cs
- TextWriterEngine.cs
- SQLInt16.cs
- DiagnosticStrings.cs
- OdbcUtils.cs
- RequestResponse.cs
- DBConcurrencyException.cs
- WebBrowserProgressChangedEventHandler.cs
- ResourceDefaultValueAttribute.cs
- Misc.cs