Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / WinForms / Managed / System / WinForms / FileDialogCustomPlacesCollection.cs / 1 / 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)
{
//Assert FileIOPermission for getting the paths for the favorites
new FileIOPermission(PermissionState.Unrestricted).Assert();
//Walk backwards
for (int i = this.Items.Count - 1; i >= 0; --i)
{
FileDialogCustomPlace customPlace = this.Items[i];
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.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PrefixHandle.cs
- TypeValidationEventArgs.cs
- Ppl.cs
- Component.cs
- PropertySegmentSerializer.cs
- HttpCookieCollection.cs
- XPathScanner.cs
- BehaviorEditorPart.cs
- activationcontext.cs
- LZCodec.cs
- Splitter.cs
- Registry.cs
- SimpleTypeResolver.cs
- WindowsSspiNegotiation.cs
- OutputCacheProfile.cs
- ClientConfigurationHost.cs
- GB18030Encoding.cs
- WsdlEndpointConversionContext.cs
- PopupRoot.cs
- lengthconverter.cs
- AutomationProperty.cs
- DefaultSection.cs
- ConfigurationSection.cs
- ProxyAttribute.cs
- GridItem.cs
- XomlCompilerResults.cs
- WebBrowserContainer.cs
- NamedElement.cs
- Attributes.cs
- RedistVersionInfo.cs
- PreviewKeyDownEventArgs.cs
- DataSourceConverter.cs
- DocumentSequenceHighlightLayer.cs
- ActiveDocumentEvent.cs
- PartialTrustVisibleAssembliesSection.cs
- DependencyObject.cs
- PathFigureCollection.cs
- HttpHandlerAction.cs
- SigningCredentials.cs
- NumericUpDown.cs
- RoleManagerEventArgs.cs
- ContextQuery.cs
- PenCursorManager.cs
- GestureRecognitionResult.cs
- RegexCompilationInfo.cs
- InstrumentationTracker.cs
- AuthenticationModuleElement.cs
- RelationshipEndMember.cs
- TrustManagerPromptUI.cs
- DefaultBinder.cs
- BinHexDecoder.cs
- XmlChildNodes.cs
- PropertyNames.cs
- AssociationEndMember.cs
- SourceFileBuildProvider.cs
- UidManager.cs
- XmlValidatingReader.cs
- Logging.cs
- WebAdminConfigurationHelper.cs
- DetailsViewInsertEventArgs.cs
- DiscoveryProxy.cs
- TokenBasedSet.cs
- Camera.cs
- FilterableAttribute.cs
- BamlRecords.cs
- StreamUpgradeAcceptor.cs
- ElementHostPropertyMap.cs
- DataControlFieldHeaderCell.cs
- TempFiles.cs
- Pair.cs
- CompilerHelpers.cs
- RegionInfo.cs
- DomainUpDown.cs
- CodeNamespaceImportCollection.cs
- TextParentUndoUnit.cs
- ListViewDeleteEventArgs.cs
- NamespaceDisplayAutomationPeer.cs
- Int32CollectionConverter.cs
- SqlServices.cs
- HttpsHostedTransportConfiguration.cs
- XmlCodeExporter.cs
- ArrangedElement.cs
- AsymmetricKeyExchangeDeformatter.cs
- PropertyBuilder.cs
- QueryStatement.cs
- QuadraticBezierSegment.cs
- IApplicationTrustManager.cs
- ExtractedStateEntry.cs
- TableCellCollection.cs
- httpstaticobjectscollection.cs
- QilName.cs
- AttributeUsageAttribute.cs
- ContainerParaClient.cs
- ThrowHelper.cs
- ResourceWriter.cs
- SignerInfo.cs
- DataTablePropertyDescriptor.cs
- odbcmetadatacolumnnames.cs
- Context.cs
- XmlBoundElement.cs