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
- EntityDataSourceWizardForm.cs
- PageClientProxyGenerator.cs
- QilXmlReader.cs
- ToolStripItemRenderEventArgs.cs
- PersonalizationState.cs
- IncrementalReadDecoders.cs
- baseaxisquery.cs
- FileInfo.cs
- ViewgenGatekeeper.cs
- JapaneseLunisolarCalendar.cs
- WebMessageEncodingBindingElement.cs
- RouteItem.cs
- Composition.cs
- EntityDataSourceSelectedEventArgs.cs
- X509Utils.cs
- RtType.cs
- SystemIcons.cs
- ProgramPublisher.cs
- UnaryNode.cs
- CapabilitiesSection.cs
- WindowsFormsSectionHandler.cs
- CategoryNameCollection.cs
- DispatcherEventArgs.cs
- XmlDataLoader.cs
- PointF.cs
- InputMethodStateTypeInfo.cs
- TypedReference.cs
- _ScatterGatherBuffers.cs
- WebPartZoneCollection.cs
- OleDbFactory.cs
- SiteMapNodeCollection.cs
- CompositeDispatchFormatter.cs
- PageContentAsyncResult.cs
- DataGridColumnsPage.cs
- ActivityXRefConverter.cs
- basevalidator.cs
- ObjectStorage.cs
- ControlsConfig.cs
- sqlstateclientmanager.cs
- Base64Encoder.cs
- EntityClassGenerator.cs
- TransformerInfoCollection.cs
- StyleCollection.cs
- DynamicScriptObject.cs
- ResourceSetExpression.cs
- WebCategoryAttribute.cs
- ReferenceSchema.cs
- NamespaceQuery.cs
- KeyTime.cs
- MissingFieldException.cs
- UntrustedRecipientException.cs
- ObjectQueryProvider.cs
- CFStream.cs
- SchemaLookupTable.cs
- StorageBasedPackageProperties.cs
- Decorator.cs
- DetailsViewInsertEventArgs.cs
- StateChangeEvent.cs
- IChannel.cs
- NativeObjectSecurity.cs
- BitmapEffectGroup.cs
- StackOverflowException.cs
- GridItem.cs
- XmlILAnnotation.cs
- DataBoundControlAdapter.cs
- SymbolEqualComparer.cs
- ProfileEventArgs.cs
- RealProxy.cs
- FrameAutomationPeer.cs
- CommentEmitter.cs
- CallTemplateAction.cs
- BoundsDrawingContextWalker.cs
- base64Transforms.cs
- DateBoldEvent.cs
- WindowsRichEditRange.cs
- FlowPanelDesigner.cs
- AuthorizationSection.cs
- SqlCacheDependencyDatabaseCollection.cs
- DriveNotFoundException.cs
- MasterPageBuildProvider.cs
- Filter.cs
- SoapTypeAttribute.cs
- SqlBinder.cs
- CorePropertiesFilter.cs
- ControllableStoryboardAction.cs
- UmAlQuraCalendar.cs
- DashStyle.cs
- EditorPartDesigner.cs
- HybridDictionary.cs
- RequestSecurityToken.cs
- Action.cs
- Crypto.cs
- WorkflowMessageEventHandler.cs
- WebServiceTypeData.cs
- HttpHandlerActionCollection.cs
- SessionStateContainer.cs
- CompatibleComparer.cs
- PriorityItem.cs
- HtmlTextArea.cs
- DataServiceRequestOfT.cs