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
- BitmapEffectGroup.cs
- ClientSettingsStore.cs
- ThrowHelper.cs
- DataSourceCache.cs
- XmlHelper.cs
- DesignerDataColumn.cs
- ClientScriptManager.cs
- _NegoStream.cs
- ZipIOLocalFileDataDescriptor.cs
- PartialTrustHelpers.cs
- CustomAttributeSerializer.cs
- PermissionListSet.cs
- TreeNodeCollection.cs
- HtmlDocument.cs
- SizeValueSerializer.cs
- UnSafeCharBuffer.cs
- HttpStaticObjectsCollectionWrapper.cs
- Model3DCollection.cs
- ColumnCollection.cs
- ExpressionBindings.cs
- SimplePropertyEntry.cs
- MouseActionConverter.cs
- FileVersionInfo.cs
- _FixedSizeReader.cs
- RequestCachePolicy.cs
- DBDataPermissionAttribute.cs
- HtmlAnchor.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- RequestCacheValidator.cs
- ListViewItemMouseHoverEvent.cs
- XAMLParseException.cs
- TabControlCancelEvent.cs
- WebSysDescriptionAttribute.cs
- TextEffect.cs
- DataControlImageButton.cs
- BindingMAnagerBase.cs
- PseudoWebRequest.cs
- StateFinalizationActivity.cs
- ServiceDescription.cs
- IProducerConsumerCollection.cs
- WindowClosedEventArgs.cs
- StringResourceManager.cs
- ProgressiveCrcCalculatingStream.cs
- GridViewSortEventArgs.cs
- DataProviderNameConverter.cs
- InputLanguageProfileNotifySink.cs
- DelegateTypeInfo.cs
- SourceElementsCollection.cs
- BulletChrome.cs
- SingleAnimationUsingKeyFrames.cs
- IndexedString.cs
- IisTraceListener.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- AutoResetEvent.cs
- XmlDomTextWriter.cs
- CodeDirectionExpression.cs
- ManagementObjectSearcher.cs
- SortDescriptionCollection.cs
- Events.cs
- OleDbSchemaGuid.cs
- SpeechRecognizer.cs
- XamlNamespaceHelper.cs
- RestHandlerFactory.cs
- TdsParserSafeHandles.cs
- SplineKeyFrames.cs
- SettingsSection.cs
- JsonXmlDataContract.cs
- EncoderExceptionFallback.cs
- InternalMappingException.cs
- WpfXamlMember.cs
- Misc.cs
- ViewManager.cs
- CompilationRelaxations.cs
- ArraySet.cs
- DataBindingExpressionBuilder.cs
- UriTemplateLiteralPathSegment.cs
- Floater.cs
- VolatileEnlistmentMultiplexing.cs
- RTLAwareMessageBox.cs
- GenericEnumConverter.cs
- ToolStripManager.cs
- SizeChangedEventArgs.cs
- Window.cs
- WebBrowserNavigatingEventHandler.cs
- DrawingImage.cs
- ResourceManager.cs
- DocumentGridContextMenu.cs
- CustomErrorCollection.cs
- TypeReference.cs
- InkCanvasAutomationPeer.cs
- ObjectDataSourceStatusEventArgs.cs
- ViewStateException.cs
- CategoryEditor.cs
- ByteStreamMessage.cs
- RegexWriter.cs
- RequestCacheManager.cs
- PropertyGridDesigner.cs
- EntitySqlQueryCacheEntry.cs
- EntryIndex.cs
- BamlWriter.cs