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
- AsymmetricKeyExchangeDeformatter.cs
- NamedPipeProcessProtocolHandler.cs
- externdll.cs
- SmiSettersStream.cs
- ColorAnimationBase.cs
- SqlSelectClauseBuilder.cs
- PersistChildrenAttribute.cs
- Encoder.cs
- ColumnCollection.cs
- altserialization.cs
- LayoutTable.cs
- Thread.cs
- DbProviderFactory.cs
- CodePrimitiveExpression.cs
- BuildResult.cs
- UpdatableGenericsFeature.cs
- NetStream.cs
- Window.cs
- ToolStripControlHost.cs
- StatusBarAutomationPeer.cs
- SystemIPAddressInformation.cs
- TaiwanLunisolarCalendar.cs
- TypeUsage.cs
- GeneralTransform3DTo2DTo3D.cs
- ApplicationProxyInternal.cs
- WebRequestModuleElement.cs
- ActiveXSite.cs
- HtmlSelect.cs
- RunWorkerCompletedEventArgs.cs
- SqlExpander.cs
- Perspective.cs
- Camera.cs
- FullTextBreakpoint.cs
- SimpleBitVector32.cs
- UndoManager.cs
- SimpleBitVector32.cs
- XmlLanguage.cs
- DeflateStream.cs
- _ShellExpression.cs
- XmlAttributes.cs
- XmlSchemaAnyAttribute.cs
- XmlStringTable.cs
- BaseValidatorDesigner.cs
- EventLogPermission.cs
- PropertyValidationContext.cs
- SoapSchemaMember.cs
- StopStoryboard.cs
- LabelLiteral.cs
- HttpCookiesSection.cs
- SqlUtil.cs
- TemplateBindingExpressionConverter.cs
- EncodingTable.cs
- PerfProviderCollection.cs
- PrintDocument.cs
- ContainerActivationHelper.cs
- TypefaceCollection.cs
- CodeTypeParameterCollection.cs
- ObjectDataSourceEventArgs.cs
- StorageInfo.cs
- DateTimeParse.cs
- XmlSequenceWriter.cs
- DbgUtil.cs
- PropertyToken.cs
- AnimationException.cs
- ArgumentReference.cs
- SqlUtil.cs
- _FtpControlStream.cs
- HtmlTableCell.cs
- XamlUtilities.cs
- TypeConverterHelper.cs
- DummyDataSource.cs
- StreamAsIStream.cs
- TypeBinaryExpression.cs
- ImageMap.cs
- WindowsAuthenticationModule.cs
- QuotedPrintableStream.cs
- ObjectDataSource.cs
- AnnotationComponentManager.cs
- Soap12ProtocolImporter.cs
- SystemFonts.cs
- ModelItemCollection.cs
- FlowDocumentFormatter.cs
- ApplicationActivator.cs
- SafeFreeMibTable.cs
- QilXmlReader.cs
- AbandonedMutexException.cs
- CompilationUnit.cs
- ComponentResourceManager.cs
- BitmapPalette.cs
- sqlnorm.cs
- AsyncOperation.cs
- SchemaObjectWriter.cs
- GridLength.cs
- Point3DConverter.cs
- PEFileEvidenceFactory.cs
- URLMembershipCondition.cs
- CardSpaceShim.cs
- EvidenceBase.cs
- HttpListenerPrefixCollection.cs
- translator.cs