Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / FileDialogCustomPlacesCollection.cs / 1305376 / FileDialogCustomPlacesCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections.ObjectModel; using System.IO; using System.Security; using System.Security.Permissions; namespace System.Windows.Forms { public class FileDialogCustomPlacesCollection : Collection{ internal void Apply(FileDialogNative.IFileDialog dialog) { //Walk backwards for (int i = this.Items.Count - 1; i >= 0; --i) { FileDialogCustomPlace customPlace = this.Items[i]; // Fix for Dev10 bug 536188: we need permission to check whether the specified path exists FileIOPermission permission = new FileIOPermission(FileIOPermissionAccess.PathDiscovery, customPlace.Path); permission.Demand(); try { FileDialogNative.IShellItem shellItem = customPlace.GetNativePath(); if (null != shellItem) { dialog.AddPlace(shellItem, 0); } } catch (FileNotFoundException) { } //Silently absorb FileNotFound exceptions (these could be caused by a path that disappeared after the place was added to the dialog). } } public void Add(string path) { Add(new FileDialogCustomPlace(path)); } public void Add(Guid knownFolderGuid) { Add(new FileDialogCustomPlace(knownFolderGuid)); } } } // 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
- IntegerValidatorAttribute.cs
- LightweightCodeGenerator.cs
- LogicalExpressionEditor.cs
- DateTimeUtil.cs
- linebase.cs
- DataGridViewRowsRemovedEventArgs.cs
- CodeAttributeDeclaration.cs
- CounterSample.cs
- LineServices.cs
- SQLInt32Storage.cs
- BookmarkInfo.cs
- AttachmentCollection.cs
- DynamicPropertyHolder.cs
- XmlSchemaAppInfo.cs
- PlaceHolder.cs
- DoubleLink.cs
- DataServiceException.cs
- TemplateXamlTreeBuilder.cs
- PieceDirectory.cs
- InstancePersistenceEvent.cs
- DecimalAnimation.cs
- ColumnMap.cs
- ImageSource.cs
- OdbcConnectionFactory.cs
- TreePrinter.cs
- TagNameToTypeMapper.cs
- Helper.cs
- Privilege.cs
- CmsInterop.cs
- EditingMode.cs
- MemoryStream.cs
- WebControlParameterProxy.cs
- RoutingSection.cs
- DesignerSerializationManager.cs
- AuthenticationService.cs
- ChannelCredentials.cs
- HtmlInputReset.cs
- InheritedPropertyChangedEventArgs.cs
- CanonicalFormWriter.cs
- InputScopeManager.cs
- ColorAnimation.cs
- ReturnValue.cs
- QilTargetType.cs
- MergeFilterQuery.cs
- NameValuePermission.cs
- XomlCompilerResults.cs
- UpdatePanelTriggerCollection.cs
- DescendentsWalker.cs
- Rules.cs
- TargetException.cs
- FirstMatchCodeGroup.cs
- SQLDecimal.cs
- ComponentConverter.cs
- CompilerGlobalScopeAttribute.cs
- WebConfigurationFileMap.cs
- TextTreeText.cs
- ScrollViewerAutomationPeer.cs
- DataSourceComponent.cs
- TextureBrush.cs
- RegistryConfigurationProvider.cs
- DetailsViewPageEventArgs.cs
- EmissiveMaterial.cs
- DelimitedListTraceListener.cs
- ToolStripArrowRenderEventArgs.cs
- _SafeNetHandles.cs
- MetaForeignKeyColumn.cs
- TableCellCollection.cs
- UIElement3DAutomationPeer.cs
- SevenBitStream.cs
- XmlEnumAttribute.cs
- LinqDataSourceSelectEventArgs.cs
- InterleavedZipPartStream.cs
- EmptyControlCollection.cs
- PathStreamGeometryContext.cs
- RegularExpressionValidator.cs
- controlskin.cs
- WebBaseEventKeyComparer.cs
- SelectionGlyph.cs
- WindowsStartMenu.cs
- UntrustedRecipientException.cs
- AsyncOperation.cs
- DataGridViewHitTestInfo.cs
- TabItem.cs
- DefaultAsyncDataDispatcher.cs
- DocumentXPathNavigator.cs
- TransformPatternIdentifiers.cs
- metadatamappinghashervisitor.cs
- MenuItemCollection.cs
- UnsafeNetInfoNativeMethods.cs
- SecurityDocument.cs
- DependencyPropertyValueSerializer.cs
- indexingfiltermarshaler.cs
- AsnEncodedData.cs
- DeferredRunTextReference.cs
- UseLicense.cs
- EndPoint.cs
- Rectangle.cs
- NativeCppClassAttribute.cs
- ReferencedCollectionType.cs
- DictionaryEntry.cs