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
- SqlDataAdapter.cs
- EndpointReference.cs
- RegexInterpreter.cs
- ServiceOperationParameter.cs
- ExceptionHelpers.cs
- RecognitionResult.cs
- EntityStoreSchemaFilterEntry.cs
- DockPattern.cs
- TextRunTypographyProperties.cs
- SafeNativeMethods.cs
- FakeModelItemImpl.cs
- ErrorTableItemStyle.cs
- WsdlBuildProvider.cs
- PropertyRecord.cs
- ListSortDescriptionCollection.cs
- NavigationProperty.cs
- ExpressionConverter.cs
- ScriptControlManager.cs
- LocalIdCollection.cs
- NullableBoolConverter.cs
- IntegerValidator.cs
- DataGridColumn.cs
- MSG.cs
- ConfigurationSectionHelper.cs
- BackgroundWorker.cs
- RSACryptoServiceProvider.cs
- DataTemplate.cs
- TypeHelper.cs
- PageThemeBuildProvider.cs
- GestureRecognitionResult.cs
- DbProviderServices.cs
- ConvertBinder.cs
- QilBinary.cs
- Root.cs
- ToolTipService.cs
- DoubleConverter.cs
- ObjectItemAttributeAssemblyLoader.cs
- FigureParaClient.cs
- CompatibleComparer.cs
- EntityDataReader.cs
- ZipIOCentralDirectoryBlock.cs
- AuthorizationSection.cs
- BufferBuilder.cs
- SqlStream.cs
- InternalConfigEventArgs.cs
- ProfileServiceManager.cs
- ShaderEffect.cs
- PingOptions.cs
- UInt64Storage.cs
- WebPartPersonalization.cs
- RC2CryptoServiceProvider.cs
- TableLayoutPanelBehavior.cs
- ValidationRule.cs
- CompilationRelaxations.cs
- WebZone.cs
- _SafeNetHandles.cs
- WebServiceParameterData.cs
- ResXBuildProvider.cs
- MessageQueueInstaller.cs
- TimerElapsedEvenArgs.cs
- SafeBitVector32.cs
- TextEndOfParagraph.cs
- TerminatorSinks.cs
- SimpleBitVector32.cs
- SafeFindHandle.cs
- SqlBuffer.cs
- EntityDataSourceQueryBuilder.cs
- HttpConfigurationContext.cs
- Aes.cs
- HttpStreamMessageEncoderFactory.cs
- SqlClientPermission.cs
- HttpResponseWrapper.cs
- SHA1.cs
- XamlClipboardData.cs
- SupportingTokenChannel.cs
- HtmlElementErrorEventArgs.cs
- ProcessHostMapPath.cs
- TriggerActionCollection.cs
- StringPropertyBuilder.cs
- ListViewGroupConverter.cs
- UpdateProgress.cs
- SqlError.cs
- DBConnection.cs
- EncoderNLS.cs
- DebugViewWriter.cs
- TdsRecordBufferSetter.cs
- ColorPalette.cs
- DataServices.cs
- TimeStampChecker.cs
- ElementProxy.cs
- DodSequenceMerge.cs
- AssertFilter.cs
- Color.cs
- BevelBitmapEffect.cs
- XslAstAnalyzer.cs
- ContainerAction.cs
- SubqueryRules.cs
- UniqueConstraint.cs
- DBBindings.cs
- FontUnit.cs