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
- ProcessInfo.cs
- Stacktrace.cs
- FragmentQuery.cs
- DocumentEventArgs.cs
- DoubleAnimationBase.cs
- XmlnsCompatibleWithAttribute.cs
- SharedConnectionWorkflowTransactionService.cs
- ProfessionalColors.cs
- AudioSignalProblemOccurredEventArgs.cs
- CodeEntryPointMethod.cs
- PreviewPrintController.cs
- ContentType.cs
- ExpressionBinding.cs
- Point3DAnimationBase.cs
- Item.cs
- StylusDevice.cs
- ApplicationServicesHostFactory.cs
- UnmanagedMemoryStream.cs
- WindowsHyperlink.cs
- MulticastIPAddressInformationCollection.cs
- BoundingRectTracker.cs
- CodeTypeDeclaration.cs
- XmlSchemaException.cs
- ToolStripManager.cs
- CompilerScopeManager.cs
- SwitchExpression.cs
- ECDiffieHellmanPublicKey.cs
- TextDecorationCollection.cs
- TdsParameterSetter.cs
- ClientSettings.cs
- StylusShape.cs
- EntitySetBaseCollection.cs
- JapaneseLunisolarCalendar.cs
- SingleResultAttribute.cs
- InvokeHandlers.cs
- SqlBooleanMismatchVisitor.cs
- DataTableReaderListener.cs
- LineUtil.cs
- Part.cs
- WebPageTraceListener.cs
- SizeAnimation.cs
- TypeDescriptorFilterService.cs
- Message.cs
- ItemType.cs
- GridViewDeletedEventArgs.cs
- ZipPackage.cs
- XamlToRtfParser.cs
- SchemaDeclBase.cs
- _BaseOverlappedAsyncResult.cs
- DataGridViewCellValidatingEventArgs.cs
- ConfigXmlAttribute.cs
- ISCIIEncoding.cs
- BaseTemplateCodeDomTreeGenerator.cs
- EventMappingSettingsCollection.cs
- FrameworkElementFactoryMarkupObject.cs
- BrowserCapabilitiesCompiler.cs
- ProtectedConfiguration.cs
- HelpKeywordAttribute.cs
- DelegatingConfigHost.cs
- TypeDefinition.cs
- HwndProxyElementProvider.cs
- RNGCryptoServiceProvider.cs
- EnumValidator.cs
- Reference.cs
- SymLanguageType.cs
- ListViewContainer.cs
- StringFunctions.cs
- FieldNameLookup.cs
- RightsManagementInformation.cs
- TraceListener.cs
- Pair.cs
- InvalidProgramException.cs
- ModelService.cs
- XPathParser.cs
- TimerElapsedEvenArgs.cs
- DocumentDesigner.cs
- ListViewGroupConverter.cs
- InfiniteTimeSpanConverter.cs
- MarkupProperty.cs
- ListBoxAutomationPeer.cs
- SQLInt32Storage.cs
- XPathBinder.cs
- IODescriptionAttribute.cs
- SiteMapNode.cs
- SocketException.cs
- Size.cs
- ArraySegment.cs
- HttpWrapper.cs
- IChannel.cs
- DataPager.cs
- XmlSchemaAppInfo.cs
- Module.cs
- AsymmetricAlgorithm.cs
- ApplicationSecurityInfo.cs
- WebSysDescriptionAttribute.cs
- RenderData.cs
- FrameworkElementFactoryMarkupObject.cs
- InkCanvasFeedbackAdorner.cs
- Wizard.cs
- columnmapfactory.cs