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
- DrawingAttributeSerializer.cs
- ThicknessAnimation.cs
- ConnectionProviderAttribute.cs
- ObjectAnimationBase.cs
- EntityDescriptor.cs
- DbMetaDataCollectionNames.cs
- ParsedRoute.cs
- Calendar.cs
- CompositeFontFamily.cs
- ToolTipService.cs
- SmtpReplyReader.cs
- RegexNode.cs
- SystemResourceKey.cs
- WebHttpBindingCollectionElement.cs
- ConfigurationStrings.cs
- WebHttpEndpoint.cs
- CodeDOMUtility.cs
- ProjectionPathSegment.cs
- ListViewSortEventArgs.cs
- DataStreamFromComStream.cs
- ContentControl.cs
- ErrorTableItemStyle.cs
- DataGridTablesFactory.cs
- FileStream.cs
- SecurityKeyIdentifierClause.cs
- MemberRelationshipService.cs
- TextElementEnumerator.cs
- DiffuseMaterial.cs
- EntityDataSourceContextCreatingEventArgs.cs
- SerializationAttributes.cs
- IPPacketInformation.cs
- Point4DConverter.cs
- DesignObjectWrapper.cs
- ProcessModelInfo.cs
- EditingMode.cs
- SqlNotificationRequest.cs
- DataViewSettingCollection.cs
- SqlGatherConsumedAliases.cs
- Property.cs
- AuthorizationSection.cs
- BamlRecordHelper.cs
- InstallerTypeAttribute.cs
- WpfGeneratedKnownTypes.cs
- TranslateTransform3D.cs
- LogoValidationException.cs
- ToolboxItemFilterAttribute.cs
- BridgeDataReader.cs
- TemplateNameScope.cs
- DynamicResourceExtensionConverter.cs
- HostExecutionContextManager.cs
- TemplatedMailWebEventProvider.cs
- RegistryKey.cs
- GridView.cs
- BindingExpressionBase.cs
- SafeNativeMethods.cs
- DoubleAnimationClockResource.cs
- ServiceContractViewControl.Designer.cs
- TypeResolvingOptionsAttribute.cs
- DynamicDocumentPaginator.cs
- SchemaConstraints.cs
- ChangeTracker.cs
- ComponentEditorPage.cs
- Panel.cs
- TdsParserSafeHandles.cs
- TableLayoutCellPaintEventArgs.cs
- URLIdentityPermission.cs
- AutomationElement.cs
- CasesDictionary.cs
- ControlCollection.cs
- Vector3dCollection.cs
- ProcessManager.cs
- PageContent.cs
- HtmlInputFile.cs
- WindowsListViewSubItem.cs
- Duration.cs
- ActivityTypeCodeDomSerializer.cs
- NonVisualControlAttribute.cs
- Geometry3D.cs
- AutoScrollExpandMessageFilter.cs
- ObjectDataSource.cs
- ContentType.cs
- PageCodeDomTreeGenerator.cs
- ToolStripProgressBar.cs
- followingsibling.cs
- LicenseContext.cs
- BrushValueSerializer.cs
- StorageAssociationSetMapping.cs
- _ServiceNameStore.cs
- ComponentResourceManager.cs
- MetadataResolver.cs
- sitestring.cs
- AutomationProperty.cs
- GeneralTransform3DGroup.cs
- SafeLibraryHandle.cs
- ProviderConnectionPointCollection.cs
- XmlFormatWriterGenerator.cs
- WebServiceData.cs
- DesignerEditorPartChrome.cs
- RemotingAttributes.cs
- DESCryptoServiceProvider.cs