Code:
/ DotNET / DotNET / 8.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
- RSAPKCS1SignatureDeformatter.cs
- ObjectNavigationPropertyMapping.cs
- EventToken.cs
- TreeViewEvent.cs
- JoinSymbol.cs
- PathGeometry.cs
- ReadOnlyCollection.cs
- HybridWebProxyFinder.cs
- FactoryId.cs
- DetailsViewUpdateEventArgs.cs
- ExtensibleClassFactory.cs
- SoapTypeAttribute.cs
- Attributes.cs
- XsdValidatingReader.cs
- MimeMultiPart.cs
- ListControl.cs
- SqlColumnizer.cs
- Ppl.cs
- XmlEntity.cs
- Wow64ConfigurationLoader.cs
- ElementHostPropertyMap.cs
- TextOptionsInternal.cs
- TraceSection.cs
- AdornerDecorator.cs
- shaper.cs
- ProgressBar.cs
- EntitySqlQueryBuilder.cs
- datacache.cs
- RowToFieldTransformer.cs
- EdmItemCollection.cs
- TabControl.cs
- ButtonField.cs
- TableItemStyle.cs
- SelectionListDesigner.cs
- Expression.cs
- UnmanagedBitmapWrapper.cs
- QueryStringConverter.cs
- DataBindingValueUIHandler.cs
- ActionFrame.cs
- UrlMappingsSection.cs
- Misc.cs
- GridView.cs
- OperationPickerDialog.designer.cs
- DataContractSet.cs
- ClrPerspective.cs
- PropertyCondition.cs
- PageCache.cs
- NamedElement.cs
- FileUtil.cs
- GenericRootAutomationPeer.cs
- Package.cs
- CallTemplateAction.cs
- DataRowCollection.cs
- DataGridViewRowConverter.cs
- HatchBrush.cs
- CredentialManagerDialog.cs
- HideDisabledControlAdapter.cs
- MouseGestureValueSerializer.cs
- UrlUtility.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- ExtractorMetadata.cs
- PageStatePersister.cs
- InfiniteTimeSpanConverter.cs
- ShutDownListener.cs
- EncodingInfo.cs
- Focus.cs
- DataFieldConverter.cs
- ExpandableObjectConverter.cs
- TextBoxLine.cs
- HelpPage.cs
- DetailsViewPageEventArgs.cs
- CompilerHelpers.cs
- Authorization.cs
- PathFigureCollection.cs
- CookieHandler.cs
- InfoCardTrace.cs
- PageEventArgs.cs
- WebBrowserContainer.cs
- QilSortKey.cs
- ImpersonateTokenRef.cs
- safesecurityhelperavalon.cs
- BoundsDrawingContextWalker.cs
- DbProviderSpecificTypePropertyAttribute.cs
- XmlArrayItemAttributes.cs
- CellRelation.cs
- controlskin.cs
- Int64KeyFrameCollection.cs
- DesignerSerializationVisibilityAttribute.cs
- Dynamic.cs
- AuthenticationManager.cs
- ConstructorExpr.cs
- DataServiceKeyAttribute.cs
- TextEditorThreadLocalStore.cs
- BinHexEncoder.cs
- GPRECT.cs
- ActivityCodeGenerator.cs
- ClientRoleProvider.cs
- UnsafeNativeMethods.cs
- Style.cs
- ItemsControl.cs