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
- EntityContainerEmitter.cs
- DBCommand.cs
- CompilationLock.cs
- DataTablePropertyDescriptor.cs
- StringKeyFrameCollection.cs
- PropVariant.cs
- Interlocked.cs
- RectangleGeometry.cs
- Dictionary.cs
- TrustManagerMoreInformation.cs
- AnnotationObservableCollection.cs
- DownloadProgressEventArgs.cs
- Camera.cs
- HierarchicalDataBoundControl.cs
- HttpModuleAction.cs
- ActivityXRefPropertyEditor.cs
- EncryptedPackageFilter.cs
- SamlDelegatingWriter.cs
- CodeAttributeArgument.cs
- SHA512.cs
- DataControlCommands.cs
- XmlValidatingReader.cs
- OleDbErrorCollection.cs
- Button.cs
- EdmType.cs
- CodeVariableDeclarationStatement.cs
- CompositeFontParser.cs
- GlobalEventManager.cs
- KeyedCollection.cs
- RuntimeHandles.cs
- Hash.cs
- SoapExtensionTypeElementCollection.cs
- CopyNodeSetAction.cs
- DataGridColumnDropSeparator.cs
- Mouse.cs
- PersonalizableTypeEntry.cs
- TranslateTransform.cs
- ForEachAction.cs
- TextContainer.cs
- BoundColumn.cs
- DoubleIndependentAnimationStorage.cs
- Transform3DGroup.cs
- CodeParameterDeclarationExpressionCollection.cs
- Int64KeyFrameCollection.cs
- SharedUtils.cs
- EntityDataSourceContainerNameConverter.cs
- XmlSchemaSimpleTypeRestriction.cs
- DupHandleConnectionReader.cs
- AssemblyCacheEntry.cs
- UnmanagedHandle.cs
- InputQueueChannelAcceptor.cs
- UseLicense.cs
- PersonalizableTypeEntry.cs
- COM2PropertyDescriptor.cs
- XmlWrappingWriter.cs
- SemaphoreFullException.cs
- WebPartChrome.cs
- DefaultMemberAttribute.cs
- FullTextState.cs
- ParallelTimeline.cs
- ManagementExtension.cs
- FilteredAttributeCollection.cs
- ExpressionBindingCollection.cs
- MenuAdapter.cs
- Light.cs
- MenuItemAutomationPeer.cs
- CancelEventArgs.cs
- DesignTimeParseData.cs
- LZCodec.cs
- HostingEnvironment.cs
- DataGridViewRowStateChangedEventArgs.cs
- SQLRoleProvider.cs
- DayRenderEvent.cs
- XPathPatternParser.cs
- Cursors.cs
- EditCommandColumn.cs
- TemplateModeChangedEventArgs.cs
- SqlDataSourceQuery.cs
- DataGridViewCellStyleChangedEventArgs.cs
- LogManagementAsyncResult.cs
- ZipIOBlockManager.cs
- ControlParameter.cs
- WpfMemberInvoker.cs
- Command.cs
- StateMachineAction.cs
- ConnectionPointCookie.cs
- CacheRequest.cs
- PasswordRecoveryDesigner.cs
- SqlInternalConnectionTds.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- DelegatedStream.cs
- DependencyPropertyKind.cs
- ImageButton.cs
- RuntimeVariableList.cs
- CustomExpression.cs
- UnsafeNativeMethods.cs
- WSSecurityOneDotOneSendSecurityHeader.cs
- Expression.cs
- ViewCellSlot.cs
- ConfigXmlSignificantWhitespace.cs