Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- CacheDependency.cs
- ClonableStack.cs
- Vector3DValueSerializer.cs
- ProtectedProviderSettings.cs
- Vector3DAnimation.cs
- TemplateField.cs
- CatalogPart.cs
- SettingsAttributeDictionary.cs
- CodeGen.cs
- FormatSettings.cs
- GlobalProxySelection.cs
- CodeTypeParameterCollection.cs
- PageParser.cs
- precedingquery.cs
- TreeNodeBinding.cs
- StyleBamlTreeBuilder.cs
- ArrayList.cs
- NumericUpDownAccelerationCollection.cs
- MatrixIndependentAnimationStorage.cs
- AsymmetricSignatureDeformatter.cs
- ElementHostPropertyMap.cs
- LineServicesCallbacks.cs
- LogArchiveSnapshot.cs
- DrawingVisual.cs
- ThreadAttributes.cs
- COM2PictureConverter.cs
- EncoderNLS.cs
- ToolStripDropDownButton.cs
- SelectionItemProviderWrapper.cs
- SoapObjectInfo.cs
- WebConfigurationHostFileChange.cs
- CodeIterationStatement.cs
- GridSplitter.cs
- SqlException.cs
- SafeThreadHandle.cs
- ValidationRuleCollection.cs
- XmlUtil.cs
- BackgroundWorker.cs
- CreateUserWizard.cs
- RemoteArgument.cs
- CodeNamespaceImportCollection.cs
- AliasedSlot.cs
- ListControl.cs
- WS2007HttpBindingElement.cs
- ConstructorNeedsTagAttribute.cs
- ECDiffieHellmanPublicKey.cs
- PageThemeCodeDomTreeGenerator.cs
- TransactionManager.cs
- OleDbError.cs
- LocalFileSettingsProvider.cs
- regiisutil.cs
- WsdlInspector.cs
- DbMetaDataFactory.cs
- BaseDataListPage.cs
- _Events.cs
- HiddenFieldPageStatePersister.cs
- RoleBoolean.cs
- DiscreteKeyFrames.cs
- namescope.cs
- Number.cs
- DefaultEventAttribute.cs
- ClientRuntimeConfig.cs
- StandardOleMarshalObject.cs
- RedirectionProxy.cs
- NavigatorInput.cs
- cache.cs
- FindRequestContext.cs
- SpellerHighlightLayer.cs
- FileRecordSequence.cs
- ToolStripManager.cs
- TextAnchor.cs
- StopStoryboard.cs
- SqlCacheDependencyDatabaseCollection.cs
- DataServices.cs
- RegisteredDisposeScript.cs
- AxisAngleRotation3D.cs
- AppDomainFactory.cs
- QueryStringConverter.cs
- Line.cs
- XsdDateTime.cs
- ExtenderControl.cs
- BCLDebug.cs
- ByteAnimationBase.cs
- TreeViewAutomationPeer.cs
- DataSysAttribute.cs
- EntityParameter.cs
- BufferCache.cs
- InvalidEnumArgumentException.cs
- ChangeInterceptorAttribute.cs
- RunWorkerCompletedEventArgs.cs
- EntityRecordInfo.cs
- CompositeClientFormatter.cs
- CodeArrayCreateExpression.cs
- RIPEMD160.cs
- Point4DValueSerializer.cs
- OptimizedTemplateContent.cs
- Group.cs
- GPRECT.cs
- CodeTypeDeclarationCollection.cs
- StringReader.cs