Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / FileDialogCustomPlacesCollection.cs / 4 / 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) { //Assert FileIOPermission for getting the paths for the favorites new FileIOPermission(PermissionState.Unrestricted).Assert(); //Walk backwards for (int i = this.Items.Count - 1; i >= 0; --i) { FileDialogCustomPlace customPlace = this.Items[i]; 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. //------------------------------------------------------------------------------ // // 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) { //Assert FileIOPermission for getting the paths for the favorites new FileIOPermission(PermissionState.Unrestricted).Assert(); //Walk backwards for (int i = this.Items.Count - 1; i >= 0; --i) { FileDialogCustomPlace customPlace = this.Items[i]; 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
- DataGridViewColumnConverter.cs
- DataControlFieldCollection.cs
- SQLBinary.cs
- precedingquery.cs
- ContentOperations.cs
- FormsAuthenticationModule.cs
- ServicePointManagerElement.cs
- ImageClickEventArgs.cs
- MenuRendererClassic.cs
- DataGridAutoFormat.cs
- DetailsViewDeletedEventArgs.cs
- DesignerActionService.cs
- DefaultPropertyAttribute.cs
- SymbolDocumentGenerator.cs
- XmlSignatureManifest.cs
- TextTreeUndo.cs
- RoleServiceManager.cs
- UnsafeNativeMethods.cs
- NullRuntimeConfig.cs
- CounterCreationDataCollection.cs
- Module.cs
- CustomError.cs
- Metadata.cs
- QueueProcessor.cs
- RequestCacheManager.cs
- XmlReturnReader.cs
- AutomationElementCollection.cs
- TreeIterator.cs
- DeleteWorkflowOwnerCommand.cs
- SQLDoubleStorage.cs
- EntityContainerRelationshipSet.cs
- DispatcherTimer.cs
- ConfigurationValidatorAttribute.cs
- Hyperlink.cs
- ButtonColumn.cs
- Rect3DValueSerializer.cs
- RowCache.cs
- InstanceValue.cs
- ImageAttributes.cs
- TextWriterEngine.cs
- XPathSelectionIterator.cs
- KnownTypeDataContractResolver.cs
- ChineseLunisolarCalendar.cs
- GenericAuthenticationEventArgs.cs
- ValidatedControlConverter.cs
- DataSourceHelper.cs
- DataTableTypeConverter.cs
- QuotedStringFormatReader.cs
- WebPartMinimizeVerb.cs
- DragDrop.cs
- SqlClientMetaDataCollectionNames.cs
- PaintValueEventArgs.cs
- XmlRawWriter.cs
- InputLanguageEventArgs.cs
- PreApplicationStartMethodAttribute.cs
- SimpleWebHandlerParser.cs
- LineServicesRun.cs
- SqlDataSourceFilteringEventArgs.cs
- ConnectionProviderAttribute.cs
- ExceptionHandlersDesigner.cs
- _LocalDataStoreMgr.cs
- ChannelBuilder.cs
- CodeSubDirectory.cs
- PassportIdentity.cs
- AutoGeneratedFieldProperties.cs
- ImageKeyConverter.cs
- UInt64Converter.cs
- UnsafeNativeMethods.cs
- OdbcErrorCollection.cs
- DrawingState.cs
- SafeNativeMemoryHandle.cs
- UTF32Encoding.cs
- TreeWalkHelper.cs
- IPAddressCollection.cs
- ClonableStack.cs
- XmlSignatureProperties.cs
- COM2ExtendedTypeConverter.cs
- PackageRelationship.cs
- BaseInfoTable.cs
- RijndaelCryptoServiceProvider.cs
- _NTAuthentication.cs
- DbInsertCommandTree.cs
- ThreadAttributes.cs
- InstancePersistenceCommandException.cs
- XmlSchemaValidationException.cs
- IntSecurity.cs
- Menu.cs
- FontFamilyConverter.cs
- SqlCacheDependencyDatabase.cs
- TextEditorThreadLocalStore.cs
- SqlNotificationEventArgs.cs
- HttpApplicationFactory.cs
- BaseAutoFormat.cs
- Accessible.cs
- TabControl.cs
- DataGridViewButtonCell.cs
- ComponentEditorPage.cs
- GenericPrincipal.cs
- RequestCachePolicyConverter.cs
- ReferentialConstraintRoleElement.cs