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
- StickyNoteHelper.cs
- StateDesigner.Layouts.cs
- ModelTypeConverter.cs
- SafeArrayRankMismatchException.cs
- ContentPosition.cs
- TextTreeNode.cs
- VarRemapper.cs
- SqlWriter.cs
- CheckedPointers.cs
- WrapPanel.cs
- SharedStatics.cs
- CloudCollection.cs
- Compilation.cs
- ExpandedProjectionNode.cs
- NetPeerTcpBindingElement.cs
- ListControl.cs
- TextBounds.cs
- TreeNodeEventArgs.cs
- FixedSOMLineCollection.cs
- ObjectReaderCompiler.cs
- LinkedResourceCollection.cs
- ThreadInterruptedException.cs
- TextProviderWrapper.cs
- XmlCDATASection.cs
- DataGridComponentEditor.cs
- ForceCopyBuildProvider.cs
- TraceContextEventArgs.cs
- UrlAuthorizationModule.cs
- GenericWebPart.cs
- ErrorLog.cs
- SystemColorTracker.cs
- RuntimeWrappedException.cs
- ListItem.cs
- BitmapPalettes.cs
- BmpBitmapDecoder.cs
- StreamInfo.cs
- TableStyle.cs
- UnsafeCollabNativeMethods.cs
- TextRunProperties.cs
- TextTreeFixupNode.cs
- FlowLayoutSettings.cs
- PointLightBase.cs
- DataProtection.cs
- SecurityUniqueId.cs
- MethodBuilder.cs
- ParseElement.cs
- FormatConvertedBitmap.cs
- BitmapEffectDrawing.cs
- OracleDataAdapter.cs
- UnsafeNativeMethods.cs
- CalendarDateRange.cs
- InvalidProgramException.cs
- TextBoxRenderer.cs
- ElementUtil.cs
- HashAlgorithm.cs
- GlyphTypeface.cs
- RightsManagementInformation.cs
- ParallelTimeline.cs
- WebPartUserCapability.cs
- ImmutableCommunicationTimeouts.cs
- CustomError.cs
- ZipIOCentralDirectoryBlock.cs
- HijriCalendar.cs
- Substitution.cs
- WinFormsSecurity.cs
- HtmlEncodedRawTextWriter.cs
- DataBoundControlHelper.cs
- HuffmanTree.cs
- XmlSchemaAttributeGroupRef.cs
- SchemaNamespaceManager.cs
- WebPartEditorApplyVerb.cs
- MessageDirection.cs
- XmlTextReaderImplHelpers.cs
- WebBrowsableAttribute.cs
- AssemblyName.cs
- Margins.cs
- AutoCompleteStringCollection.cs
- FormatVersion.cs
- SHA384Managed.cs
- ByteStream.cs
- InvokeGenerator.cs
- AddToCollection.cs
- AdditionalEntityFunctions.cs
- KeyboardNavigation.cs
- TimeoutTimer.cs
- PeerInvitationResponse.cs
- WebBrowserDocumentCompletedEventHandler.cs
- PolyQuadraticBezierSegment.cs
- XamlClipboardData.cs
- WebBodyFormatMessageProperty.cs
- TargetParameterCountException.cs
- Propagator.JoinPropagator.cs
- securestring.cs
- CatalogPartChrome.cs
- ActivityExecutorOperation.cs
- InternalConfigSettingsFactory.cs
- ParentUndoUnit.cs
- ClientFormsAuthenticationCredentials.cs
- LaxModeSecurityHeaderElementInferenceEngine.cs
- LinkUtilities.cs