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
- DelegatingChannelListener.cs
- BooleanExpr.cs
- UrlMapping.cs
- SerialStream.cs
- PeerApplicationLaunchInfo.cs
- TypedCompletedAsyncResult.cs
- PostBackOptions.cs
- FilterEventArgs.cs
- DeclarativeConditionsCollection.cs
- HttpResponseHeader.cs
- ControlEvent.cs
- FlowDocumentReaderAutomationPeer.cs
- Model3D.cs
- MetadataSource.cs
- FixedSOMLineRanges.cs
- XmlConvert.cs
- SurrogateEncoder.cs
- NetworkInterface.cs
- XmlSchemaRedefine.cs
- TimeSpanValidatorAttribute.cs
- UIElementCollection.cs
- mediapermission.cs
- ResourceBinder.cs
- BitmapMetadataEnumerator.cs
- ZoneMembershipCondition.cs
- TdsEnums.cs
- DoWhileDesigner.xaml.cs
- VSWCFServiceContractGenerator.cs
- TextTreeTextElementNode.cs
- StatusBarAutomationPeer.cs
- ISSmlParser.cs
- ConstructorArgumentAttribute.cs
- BrowsableAttribute.cs
- AliasExpr.cs
- DataObjectSettingDataEventArgs.cs
- MgmtConfigurationRecord.cs
- WindowsAuthenticationEventArgs.cs
- securitycriticaldataClass.cs
- FlowSwitch.cs
- WebContext.cs
- ObjectIDGenerator.cs
- StrongBox.cs
- DataPagerFieldCommandEventArgs.cs
- BitArray.cs
- FrugalMap.cs
- MSAANativeProvider.cs
- ImageListStreamer.cs
- CmsInterop.cs
- util.cs
- XamlStream.cs
- CachedBitmap.cs
- ScriptBehaviorDescriptor.cs
- BaseAddressPrefixFilterElementCollection.cs
- TimeSpanFormat.cs
- GeneralTransformCollection.cs
- DSASignatureDeformatter.cs
- ImageInfo.cs
- XmlNamespaceMappingCollection.cs
- EventLogInternal.cs
- WasHttpModulesInstallComponent.cs
- HttpRuntime.cs
- TextDecorationCollection.cs
- DatePickerDateValidationErrorEventArgs.cs
- FormsAuthenticationTicket.cs
- MD5CryptoServiceProvider.cs
- ClockController.cs
- DataGridGeneralPage.cs
- NativeMethods.cs
- GridViewHeaderRowPresenter.cs
- _NestedMultipleAsyncResult.cs
- DBDataPermissionAttribute.cs
- DataViewSettingCollection.cs
- ViewGenResults.cs
- WebPartCatalogCloseVerb.cs
- ADRoleFactoryConfiguration.cs
- SqlStatistics.cs
- ConnectionsZone.cs
- FileLogRecordEnumerator.cs
- DurationConverter.cs
- MenuBase.cs
- FixedFindEngine.cs
- CmsInterop.cs
- MsmqInputChannel.cs
- Drawing.cs
- ToolStripDropDownClosingEventArgs.cs
- ContextBase.cs
- FragmentQuery.cs
- BitmapEffectvisualstate.cs
- CodeCommentStatement.cs
- ToolStrip.cs
- TransferRequestHandler.cs
- Point3DCollectionValueSerializer.cs
- WindowsContainer.cs
- ImageSource.cs
- Property.cs
- KnownIds.cs
- OdbcConnectionFactory.cs
- DBDataPermission.cs
- ModuleConfigurationInfo.cs
- NumberSubstitution.cs