Code:
/ FX-1434 / FX-1434 / 1.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
- SmtpReplyReaderFactory.cs
- EntitySqlQueryState.cs
- NativeMethods.cs
- WebPartUserCapability.cs
- OdbcDataReader.cs
- CodePropertyReferenceExpression.cs
- BaseParser.cs
- ExeContext.cs
- HelpInfo.cs
- LocalBuilder.cs
- NumberSubstitution.cs
- IMembershipProvider.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- DocumentApplicationJournalEntry.cs
- SystemEvents.cs
- ThumbButtonInfoCollection.cs
- NegatedCellConstant.cs
- WindowsStatic.cs
- LinqExpressionNormalizer.cs
- ZoneIdentityPermission.cs
- XMLSyntaxException.cs
- SqlDataSourceView.cs
- WebConfigurationHost.cs
- FileDialog.cs
- InstanceLockedException.cs
- TableCellCollection.cs
- VersionPair.cs
- InternalBufferManager.cs
- MetadataItemSerializer.cs
- ScriptServiceAttribute.cs
- KeyInfo.cs
- Matrix3DConverter.cs
- Point3DConverter.cs
- HtmlHistory.cs
- XmlResolver.cs
- ImageConverter.cs
- NameValueConfigurationElement.cs
- MappingModelBuildProvider.cs
- BitmapSourceSafeMILHandle.cs
- SemanticValue.cs
- WebBrowsableAttribute.cs
- EmptyEnumerator.cs
- CustomError.cs
- x509utils.cs
- DispatcherExceptionEventArgs.cs
- PrinterSettings.cs
- DynamicRendererThreadManager.cs
- FontNameEditor.cs
- FileDialog.cs
- _FtpControlStream.cs
- SimpleTypeResolver.cs
- ToolStripSystemRenderer.cs
- FrameworkContentElement.cs
- BitmapCodecInfoInternal.cs
- Trigger.cs
- LinkArea.cs
- RoleService.cs
- CodePropertyReferenceExpression.cs
- NativeObjectSecurity.cs
- InvalidPrinterException.cs
- _SSPISessionCache.cs
- NetworkInformationException.cs
- MimeParameterWriter.cs
- CfgParser.cs
- TypeConstant.cs
- DataGridViewColumnEventArgs.cs
- CaseExpr.cs
- DataGridViewButtonCell.cs
- Documentation.cs
- DataGridBeginningEditEventArgs.cs
- DiagnosticTrace.cs
- SafeLocalAllocation.cs
- Rfc4050KeyFormatter.cs
- BindableAttribute.cs
- TextEditorDragDrop.cs
- DocumentApplicationJournalEntry.cs
- XhtmlConformanceSection.cs
- RectAnimationBase.cs
- RuleSetDialog.cs
- ControlEvent.cs
- Base64Decoder.cs
- ConfigurationStrings.cs
- AdornerDecorator.cs
- PageCodeDomTreeGenerator.cs
- ListCollectionView.cs
- EventLogWatcher.cs
- ellipse.cs
- DirtyTextRange.cs
- PartialArray.cs
- TimeIntervalCollection.cs
- ConfigurationManagerInternal.cs
- RightsController.cs
- WebPartDescriptionCollection.cs
- DataViewManager.cs
- HttpStreamXmlDictionaryWriter.cs
- GroupStyle.cs
- CommandLibraryHelper.cs
- InternalMappingException.cs
- TrackingValidationObjectDictionary.cs
- WindowProviderWrapper.cs