Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / FileDialogCustomPlacesCollection.cs / 4 / 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
- InlineObject.cs
- SessionStateItemCollection.cs
- HtmlImage.cs
- TheQuery.cs
- SQLChars.cs
- HttpListener.cs
- ExtensionFile.cs
- StructuredTypeEmitter.cs
- OracleNumber.cs
- CompilerTypeWithParams.cs
- OleDbConnectionInternal.cs
- DynamicPropertyReader.cs
- PanelStyle.cs
- VisualStyleInformation.cs
- DataListGeneralPage.cs
- ColumnCollection.cs
- EntityDataSourceViewSchema.cs
- MulticastNotSupportedException.cs
- TrackingProfileDeserializationException.cs
- HtmlWindow.cs
- CodeGen.cs
- BitmapEffectInputData.cs
- DocumentEventArgs.cs
- SelfIssuedAuthRSAPKCS1SignatureDeformatter.cs
- PeerEndPoint.cs
- ContainsSearchOperator.cs
- ImportStoreException.cs
- HTMLTextWriter.cs
- FormViewUpdatedEventArgs.cs
- LoadMessageLogger.cs
- MILUtilities.cs
- LateBoundChannelParameterCollection.cs
- CompiledWorkflowDefinitionContext.cs
- MenuAutoFormat.cs
- AdornerPresentationContext.cs
- ThumbAutomationPeer.cs
- CompositeFontFamily.cs
- PropertyPathConverter.cs
- SymmetricKeyWrap.cs
- TextPointerBase.cs
- ToolStripSplitButton.cs
- CommandID.cs
- MouseGestureConverter.cs
- AttributeUsageAttribute.cs
- RuleProcessor.cs
- MimeMapping.cs
- SqlDataSourceView.cs
- SqlGenerator.cs
- QueryException.cs
- FormViewInsertEventArgs.cs
- XmlAttributeAttribute.cs
- DynamicQueryableWrapper.cs
- SendKeys.cs
- SQLMoneyStorage.cs
- WebServiceFaultDesigner.cs
- AsyncResult.cs
- RemoteHelper.cs
- XPathException.cs
- CaretElement.cs
- UInt16.cs
- DefaultValueTypeConverter.cs
- OpenTypeLayout.cs
- MonikerHelper.cs
- TableCell.cs
- StreamMarshaler.cs
- __ComObject.cs
- CompilerLocalReference.cs
- BindingExpression.cs
- TemplateLookupAction.cs
- TCPClient.cs
- DataGridViewCellStyle.cs
- EllipseGeometry.cs
- FileLevelControlBuilderAttribute.cs
- XpsS0ValidatingLoader.cs
- MethodRental.cs
- SymLanguageVendor.cs
- InheritanceContextChangedEventManager.cs
- MouseButtonEventArgs.cs
- Bits.cs
- Parameter.cs
- SuppressIldasmAttribute.cs
- GlyphRunDrawing.cs
- BindingMAnagerBase.cs
- EntityDataSourceQueryBuilder.cs
- TabletCollection.cs
- LineServicesCallbacks.cs
- ActivityXamlServices.cs
- RuntimeArgumentHandle.cs
- DataGridrowEditEndingEventArgs.cs
- DynamicRenderer.cs
- AlphabetConverter.cs
- WebPartConnectVerb.cs
- DBConnection.cs
- WebEncodingValidatorAttribute.cs
- NetworkInformationException.cs
- TextHidden.cs
- WindowsFormsHostPropertyMap.cs
- PresentationTraceSources.cs
- InputLangChangeEvent.cs
- SQLInt64Storage.cs