Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // //----------------------------------------------------------------------------- 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- _ListenerAsyncResult.cs
- TdsParameterSetter.cs
- XmlSchemaExternal.cs
- KerberosTicketHashIdentifierClause.cs
- SelectionRangeConverter.cs
- UserControl.cs
- OrderPreservingPipeliningSpoolingTask.cs
- DialogBaseForm.cs
- SrgsNameValueTag.cs
- OracleTransaction.cs
- DataFormat.cs
- StubHelpers.cs
- ListControlConvertEventArgs.cs
- ListBoxAutomationPeer.cs
- HttpListenerContext.cs
- RadioButton.cs
- DllHostedComPlusServiceHost.cs
- Effect.cs
- AutoResetEvent.cs
- SafeFileMappingHandle.cs
- BookmarkScopeInfo.cs
- Registry.cs
- UriWriter.cs
- BeginEvent.cs
- XmlILIndex.cs
- SortKey.cs
- PersonalizationState.cs
- PropertyDescriptorGridEntry.cs
- SqlUtils.cs
- MailWriter.cs
- EnumerableRowCollectionExtensions.cs
- TreeBuilderXamlTranslator.cs
- XDRSchema.cs
- EncoderExceptionFallback.cs
- DemultiplexingClientMessageFormatter.cs
- ProxyGenerationError.cs
- CodeArrayIndexerExpression.cs
- DataReceivedEventArgs.cs
- EditorZone.cs
- ColumnMapVisitor.cs
- ByteRangeDownloader.cs
- Pair.cs
- TextTreeUndo.cs
- WpfKnownMemberInvoker.cs
- ResourceExpressionBuilder.cs
- Authorization.cs
- ThreadBehavior.cs
- DataTrigger.cs
- Soap11ServerProtocol.cs
- XNodeNavigator.cs
- UrlRoutingHandler.cs
- UpDownBase.cs
- ProfileBuildProvider.cs
- StringTraceRecord.cs
- FixedSOMGroup.cs
- ObjectCloneHelper.cs
- GridViewCellAutomationPeer.cs
- AbandonedMutexException.cs
- TreeViewItemAutomationPeer.cs
- ObjectDataSourceStatusEventArgs.cs
- HiddenField.cs
- XsltContext.cs
- CommandBinding.cs
- ThreadNeutralSemaphore.cs
- HttpModuleActionCollection.cs
- SplitterPanel.cs
- TextFormatterHost.cs
- SafeNativeMethodsCLR.cs
- TextSpanModifier.cs
- SettingsPropertyCollection.cs
- DispatchChannelSink.cs
- Stopwatch.cs
- TransactionScope.cs
- DefaultValueConverter.cs
- MatrixIndependentAnimationStorage.cs
- RichTextBoxConstants.cs
- RecognizedWordUnit.cs
- DrawListViewColumnHeaderEventArgs.cs
- _BufferOffsetSize.cs
- COAUTHIDENTITY.cs
- BamlResourceDeserializer.cs
- DesignerVerb.cs
- DataContractSerializerSection.cs
- DataDocumentXPathNavigator.cs
- ClientSponsor.cs
- ReachUIElementCollectionSerializer.cs
- ContractHandle.cs
- Menu.cs
- ZipPackage.cs
- MD5.cs
- TcpActivation.cs
- AmbientProperties.cs
- ActivityMarkupSerializationProvider.cs
- RenderData.cs
- ChangeConflicts.cs
- AsymmetricSignatureDeformatter.cs
- ByteStorage.cs
- MediaEntryAttribute.cs
- SqlColumnizer.cs
- XamlSerializerUtil.cs