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
- TemplateComponentConnector.cs
- AppDomainProtocolHandler.cs
- MatrixValueSerializer.cs
- AuthenticationServiceManager.cs
- DelegatingConfigHost.cs
- BufferBuilder.cs
- HttpResponseInternalWrapper.cs
- ApplicationFileParser.cs
- DelayedRegex.cs
- WindowsTreeView.cs
- MessageHeaderDescription.cs
- Point3DAnimationUsingKeyFrames.cs
- _NativeSSPI.cs
- WebControl.cs
- DesignerActionVerbList.cs
- SchemaLookupTable.cs
- ContainerUtilities.cs
- SiteMapNodeItemEventArgs.cs
- SourceFileInfo.cs
- LicFileLicenseProvider.cs
- CustomWebEventKey.cs
- OutKeywords.cs
- DataColumnCollection.cs
- XmlComment.cs
- ObjectDataSourceStatusEventArgs.cs
- NamespaceTable.cs
- RectangleConverter.cs
- TextSelection.cs
- FixedSOMTableCell.cs
- PeerApplicationLaunchInfo.cs
- OrderedDictionaryStateHelper.cs
- RowBinding.cs
- CheckBox.cs
- SourceInterpreter.cs
- ProfileGroupSettings.cs
- SqlCacheDependencySection.cs
- _AutoWebProxyScriptEngine.cs
- ProcessHostConfigUtils.cs
- ToolStripPanelRow.cs
- XmlException.cs
- StylusCollection.cs
- HtmlInputFile.cs
- ErrorItem.cs
- CheckBoxList.cs
- ColorKeyFrameCollection.cs
- ConfigXmlAttribute.cs
- NavigationWindow.cs
- WorkflowApplicationEventArgs.cs
- TrustManager.cs
- RuleAttributes.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- ColumnResizeUndoUnit.cs
- ApplyTemplatesAction.cs
- ProfileSection.cs
- HorizontalAlignConverter.cs
- FontConverter.cs
- Lease.cs
- URIFormatException.cs
- OleStrCAMarshaler.cs
- ToolbarAUtomationPeer.cs
- ListChunk.cs
- TextBoxBase.cs
- RestHandlerFactory.cs
- BaseResourcesBuildProvider.cs
- OleDbRowUpdatedEvent.cs
- Subset.cs
- ChtmlTextWriter.cs
- Menu.cs
- Ops.cs
- CounterSample.cs
- RecognizerInfo.cs
- CrossContextChannel.cs
- GroupBoxAutomationPeer.cs
- iisPickupDirectory.cs
- SecUtil.cs
- HttpListenerTimeoutManager.cs
- CodeRegionDirective.cs
- pingexception.cs
- PenLineCapValidation.cs
- LogicalMethodInfo.cs
- GlobalProxySelection.cs
- BindingExpressionBase.cs
- RelationshipDetailsRow.cs
- SrgsGrammar.cs
- PathSegment.cs
- ExecutionContext.cs
- CancelEventArgs.cs
- Membership.cs
- WindowsListViewGroupHelper.cs
- ListBoxItemWrapperAutomationPeer.cs
- EnvelopedPkcs7.cs
- SemaphoreFullException.cs
- TypefaceCollection.cs
- DelegatingTypeDescriptionProvider.cs
- CursorConverter.cs
- CompilerError.cs
- HttpModule.cs
- JsonXmlDataContract.cs
- EditorOptionAttribute.cs
- SqlDataSourceEnumerator.cs