Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Services / Monitoring / system / Diagnosticts / Design / InstanceNameConverter.cs / 1 / InstanceNameConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Diagnostics.Design { using System.Runtime.Serialization.Formatters; using System.Globalization; using System.Diagnostics; using System; using System.Windows.Forms.ComponentModel; using System.ComponentModel; using System.ComponentModel.Design; using System.Collections; internal class InstanceNameConverter : TypeConverter { ////// /// public InstanceNameConverter() { } public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) { return true; } return base.CanConvertFrom(context, sourceType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { string text = ((string)value).Trim(); return text; } return base.ConvertFrom(context, culture, value); } ////// Initializes a new instance of the 'InstanceNameConverter' class for the given type. /// ////// /// /// public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { PerformanceCounter counter = (context == null) ? null : context.Instance as PerformanceCounter; string machineName = "."; string categoryName = String.Empty; if (counter != null) { machineName = counter.MachineName; categoryName = counter.CategoryName; } try { PerformanceCounterCategory cat = new PerformanceCounterCategory(categoryName, machineName); string[] retVal =cat.GetInstanceNames(); Array.Sort(retVal, Comparer.Default); return new StandardValuesCollection(retVal); } catch(Exception) { ; // do nothing } return null; } ///Gets a collection of standard values for the data type this validator is /// designed for. ////// /// /// public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.Gets a value indicating /// whether this object /// supports a standard set of values that can be picked /// from a list using the specified context. ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StrokeIntersection.cs
- DesignerActionVerbItem.cs
- CurrencyWrapper.cs
- XmlReflectionImporter.cs
- PerformanceCounterPermissionEntry.cs
- TreeNodeCollectionEditor.cs
- LockedAssemblyCache.cs
- CustomAttribute.cs
- ReflectTypeDescriptionProvider.cs
- AssociationSetEnd.cs
- MasterPageBuildProvider.cs
- FixedSOMElement.cs
- TableLayoutSettings.cs
- WindowCollection.cs
- MergeFailedEvent.cs
- ResetableIterator.cs
- MulticastOption.cs
- Asn1IntegerConverter.cs
- XmlUrlEditor.cs
- RepeaterCommandEventArgs.cs
- AlphabeticalEnumConverter.cs
- GeometryCollection.cs
- CounterCreationData.cs
- FixedFlowMap.cs
- OrthographicCamera.cs
- SecurityKeyIdentifier.cs
- LoginUtil.cs
- ToolStripDropDownButton.cs
- AttributeEmitter.cs
- DrawingContextWalker.cs
- SemanticKeyElement.cs
- SoapClientMessage.cs
- DelimitedListTraceListener.cs
- WorkflowInlining.cs
- HostingEnvironment.cs
- TableLayoutSettings.cs
- AlphaSortedEnumConverter.cs
- QueryPageSettingsEventArgs.cs
- DLinqColumnProvider.cs
- CorrelationActionMessageFilter.cs
- MultiSelector.cs
- WindowsFormsHelpers.cs
- MethodBuilder.cs
- DecoderFallback.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- RequestQueryProcessor.cs
- CaseInsensitiveHashCodeProvider.cs
- AuthenticationSection.cs
- ResolveDuplexCD1AsyncResult.cs
- UriSectionData.cs
- EncoderExceptionFallback.cs
- BinaryReader.cs
- CompilerError.cs
- DataGridViewIntLinkedList.cs
- HtmlAnchor.cs
- DifferencingCollection.cs
- _ShellExpression.cs
- DateTimeParse.cs
- AddInPipelineAttributes.cs
- ConfigXmlElement.cs
- Separator.cs
- ColorContextHelper.cs
- DetailsViewInsertEventArgs.cs
- FilteredAttributeCollection.cs
- TextHintingModeValidation.cs
- WinEventHandler.cs
- CallContext.cs
- TextParentUndoUnit.cs
- SystemInfo.cs
- TraceContext.cs
- ReversePositionQuery.cs
- ProviderConnectionPointCollection.cs
- X509Certificate2.cs
- DebugManager.cs
- TreeNodeBindingDepthConverter.cs
- ExpressionNode.cs
- _NestedMultipleAsyncResult.cs
- Color.cs
- SmiMetaData.cs
- BookmarkEventArgs.cs
- PngBitmapEncoder.cs
- DSACryptoServiceProvider.cs
- MailHeaderInfo.cs
- VirtualPathProvider.cs
- HitTestWithGeometryDrawingContextWalker.cs
- AssemblyCollection.cs
- FileDataSourceCache.cs
- XPathChildIterator.cs
- ExceptionNotification.cs
- BamlBinaryWriter.cs
- DynamicILGenerator.cs
- OleDbPropertySetGuid.cs
- FixedDocumentSequencePaginator.cs
- SID.cs
- PointLight.cs
- MultiByteCodec.cs
- ConstraintManager.cs
- FixedHyperLink.cs
- AsyncPostBackErrorEventArgs.cs
- hebrewshape.cs