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
- MultipleViewProviderWrapper.cs
- SHA512Managed.cs
- SoapSchemaImporter.cs
- ImageAttributes.cs
- XmlSchemaSimpleTypeRestriction.cs
- EncodingDataItem.cs
- Helpers.cs
- SapiAttributeParser.cs
- BitmapPalette.cs
- PersonalizationState.cs
- CodeIdentifiers.cs
- DataAdapter.cs
- DataBoundControlAdapter.cs
- ButtonChrome.cs
- FunctionImportMapping.cs
- JsonStringDataContract.cs
- HtmlHistory.cs
- _UncName.cs
- TrustSection.cs
- WebExceptionStatus.cs
- DataGridViewComboBoxEditingControl.cs
- FrameworkTextComposition.cs
- Imaging.cs
- BamlReader.cs
- CallbackValidatorAttribute.cs
- SafeWaitHandle.cs
- FunctionParameter.cs
- TextOnlyOutput.cs
- ContentHostHelper.cs
- DesignerProperties.cs
- PropertyPathConverter.cs
- EllipseGeometry.cs
- FloaterParaClient.cs
- SymbolEqualComparer.cs
- ServiceParser.cs
- HttpCacheVary.cs
- Collection.cs
- XmlILAnnotation.cs
- ObjectDisposedException.cs
- ReaderContextStackData.cs
- DbgCompiler.cs
- Border.cs
- WSSecurityXXX2005.cs
- Exceptions.cs
- ForwardPositionQuery.cs
- UserPreferenceChangingEventArgs.cs
- HttpRuntimeSection.cs
- DocumentGrid.cs
- HttpListenerRequest.cs
- OdbcConnectionFactory.cs
- SynchronizationLockException.cs
- input.cs
- ThicknessAnimationBase.cs
- ContentFilePart.cs
- HttpWriter.cs
- CollectionView.cs
- XamlStackWriter.cs
- ChangeTracker.cs
- ColumnCollection.cs
- ExtensionWindowResizeGrip.cs
- UnicastIPAddressInformationCollection.cs
- CustomSignedXml.cs
- TdsValueSetter.cs
- webbrowsersite.cs
- TemplateXamlParser.cs
- Page.cs
- PointLightBase.cs
- DataGridColumnHeaderAutomationPeer.cs
- TreeViewAutomationPeer.cs
- ActivityDesigner.cs
- HwndSourceKeyboardInputSite.cs
- EntityTypeEmitter.cs
- TextEndOfSegment.cs
- UnmanagedHandle.cs
- EventDriven.cs
- TextTreeUndoUnit.cs
- ZipFileInfo.cs
- SQLRoleProvider.cs
- MessageEnumerator.cs
- DeploymentSection.cs
- SpecialNameAttribute.cs
- ModelVisual3D.cs
- ServiceMetadataExtension.cs
- ValueOfAction.cs
- SystemSounds.cs
- EntityDataSourceMemberPath.cs
- ExpressionConverter.cs
- ImageCodecInfoPrivate.cs
- UniqueEventHelper.cs
- CurrentChangingEventArgs.cs
- CodePageUtils.cs
- WebPartActionVerb.cs
- ReachFixedDocumentSerializerAsync.cs
- RegexCharClass.cs
- DataTableMapping.cs
- SerializationObjectManager.cs
- MultidimensionalArrayItemReference.cs
- IItemContainerGenerator.cs
- ProcessInputEventArgs.cs
- HitTestWithPointDrawingContextWalker.cs