Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / WinForms / Managed / System / WinForms / SpecialFolderEnumConverter.cs / 1 / SpecialFolderEnumConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; using System.ComponentModel; using System.Collections; internal class SpecialFolderEnumConverter : AlphaSortedEnumConverter { public SpecialFolderEnumConverter(Type type) : base(type) { } ////// See VSWhidbey #376570. Personal appears twice in type editor because its numeric value matches with MyDocuments. /// This code filters out the duplicate value. public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { StandardValuesCollection values = base.GetStandardValues(context); ArrayList list = new ArrayList(); int count = values.Count; bool personalSeen = false; for (int i = 0; i < count; i++) { if (values[i] is System.Environment.SpecialFolder && values[i].Equals(System.Environment.SpecialFolder.Personal)) { if (!personalSeen) { personalSeen = true; list.Add(values[i]); } } else { list.Add(values[i]); } } return new StandardValuesCollection(list); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; using System.ComponentModel; using System.Collections; internal class SpecialFolderEnumConverter : AlphaSortedEnumConverter { public SpecialFolderEnumConverter(Type type) : base(type) { } ////// See VSWhidbey #376570. Personal appears twice in type editor because its numeric value matches with MyDocuments. /// This code filters out the duplicate value. public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { StandardValuesCollection values = base.GetStandardValues(context); ArrayList list = new ArrayList(); int count = values.Count; bool personalSeen = false; for (int i = 0; i < count; i++) { if (values[i] is System.Environment.SpecialFolder && values[i].Equals(System.Environment.SpecialFolder.Personal)) { if (!personalSeen) { personalSeen = true; list.Add(values[i]); } } else { list.Add(values[i]); } } return new StandardValuesCollection(list); } } } // 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
- SafeNativeMethods.cs
- PinnedBufferMemoryStream.cs
- InputScope.cs
- ListViewHitTestInfo.cs
- StylusPlugInCollection.cs
- TextRangeEditLists.cs
- DesignerVerbCollection.cs
- PanelStyle.cs
- MouseOverProperty.cs
- ScrollBar.cs
- QueryCacheManager.cs
- webbrowsersite.cs
- TableColumn.cs
- WebInvokeAttribute.cs
- contentDescriptor.cs
- TempFiles.cs
- DataGridRowClipboardEventArgs.cs
- SafeThreadHandle.cs
- IssuanceTokenProviderBase.cs
- PanelStyle.cs
- GridViewUpdateEventArgs.cs
- ManipulationCompletedEventArgs.cs
- BitConverter.cs
- sqlmetadatafactory.cs
- SerializationException.cs
- ImageDrawing.cs
- ClientSettingsStore.cs
- Merger.cs
- RemotingServices.cs
- WebAdminConfigurationHelper.cs
- LocatorGroup.cs
- DbMetaDataCollectionNames.cs
- PathData.cs
- RequestCachingSection.cs
- ClientFormsAuthenticationMembershipProvider.cs
- ControlBuilder.cs
- FixedSOMPageConstructor.cs
- DefaultCompensation.cs
- CodeObject.cs
- LocalizationComments.cs
- SamlConditions.cs
- WpfGeneratedKnownProperties.cs
- RecognizedPhrase.cs
- BaseDataListComponentEditor.cs
- FacetDescription.cs
- ClaimSet.cs
- ArraySortHelper.cs
- connectionpool.cs
- Object.cs
- SafeNativeHandle.cs
- ErrorFormatterPage.cs
- XPathNavigatorKeyComparer.cs
- MimeTypeAttribute.cs
- SrgsNameValueTag.cs
- SafeEventHandle.cs
- Util.cs
- EditingMode.cs
- Automation.cs
- ThreadAbortException.cs
- RelatedEnd.cs
- SynchronizationLockException.cs
- OptimalTextSource.cs
- SystemColorTracker.cs
- Splitter.cs
- AspNetHostingPermission.cs
- HttpApplication.cs
- IConvertible.cs
- D3DImage.cs
- Span.cs
- MarkupExtensionParser.cs
- WebEventCodes.cs
- DeflateEmulationStream.cs
- XPathBinder.cs
- MediaContextNotificationWindow.cs
- XhtmlConformanceSection.cs
- SqlXml.cs
- DefaultValueConverter.cs
- oledbmetadatacolumnnames.cs
- RepeaterCommandEventArgs.cs
- NameValueCache.cs
- AnnotationComponentManager.cs
- BeginSelectCardRequest.cs
- AuthorizationRule.cs
- WindowsNonControl.cs
- TableRowCollection.cs
- SchemaExporter.cs
- VectorConverter.cs
- ConfigsHelper.cs
- DivideByZeroException.cs
- LoaderAllocator.cs
- TaskResultSetter.cs
- BamlStream.cs
- QueryableDataSource.cs
- XmlMemberMapping.cs
- LayoutSettings.cs
- CollectionViewGroup.cs
- XmlSchemaAnnotation.cs
- WebPartMovingEventArgs.cs
- SafeLibraryHandle.cs
- DesignerOptionService.cs