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
- SqlUtil.cs
- LineBreak.cs
- _SslStream.cs
- OdbcErrorCollection.cs
- SortedSetDebugView.cs
- AlternationConverter.cs
- EditingCoordinator.cs
- Wrapper.cs
- PostBackOptions.cs
- DataGridViewColumnStateChangedEventArgs.cs
- StaticExtension.cs
- sitestring.cs
- NamespaceList.cs
- Latin1Encoding.cs
- SortExpressionBuilder.cs
- RoleGroupCollection.cs
- GeneralTransform3DTo2D.cs
- ControlEvent.cs
- FontFamilyIdentifier.cs
- OciEnlistContext.cs
- ConfigurationElementProperty.cs
- PictureBox.cs
- BitmapEffectState.cs
- nulltextcontainer.cs
- CalendarTable.cs
- GroupAggregateExpr.cs
- Latin1Encoding.cs
- SqlNodeTypeOperators.cs
- SiteMapDataSource.cs
- PerSessionInstanceContextProvider.cs
- Translator.cs
- ObjectDataSourceMethodEventArgs.cs
- ElementAtQueryOperator.cs
- EpmSyndicationContentSerializer.cs
- DocumentScope.cs
- WebFaultException.cs
- CardSpaceSelector.cs
- RequestCachePolicy.cs
- ComboBox.cs
- TextTreeObjectNode.cs
- HttpResponse.cs
- ConstructorBuilder.cs
- invalidudtexception.cs
- XmlParserContext.cs
- XmlSchemaNotation.cs
- AttributeCollection.cs
- TrimSurroundingWhitespaceAttribute.cs
- SamlSubject.cs
- OrderPreservingMergeHelper.cs
- ProxyElement.cs
- Compiler.cs
- SharedUtils.cs
- CellPartitioner.cs
- FontUnitConverter.cs
- HttpListenerRequestTraceRecord.cs
- CreateUserWizardStep.cs
- ScriptReferenceBase.cs
- GridViewRowPresenterBase.cs
- FilteredAttributeCollection.cs
- DecimalFormatter.cs
- WinCategoryAttribute.cs
- SafeNativeMethods.cs
- Identity.cs
- BaseTemplateCodeDomTreeGenerator.cs
- Binding.cs
- XmlSchemaSimpleContentRestriction.cs
- PrimitiveXmlSerializers.cs
- BufferedWebEventProvider.cs
- ToolboxDataAttribute.cs
- TemplateKey.cs
- IMembershipProvider.cs
- InvalidPrinterException.cs
- VerificationAttribute.cs
- WmiInstallComponent.cs
- DataColumnPropertyDescriptor.cs
- NativeRecognizer.cs
- DataGridViewTextBoxCell.cs
- FontWeight.cs
- MenuItem.cs
- CompModHelpers.cs
- listitem.cs
- ColumnClickEvent.cs
- TableLayoutPanel.cs
- ConnectionStringsSection.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- DynamicAttribute.cs
- SpellCheck.cs
- ImageDesigner.cs
- EventRecordWrittenEventArgs.cs
- unsafeIndexingFilterStream.cs
- WindowsStatusBar.cs
- TransactionOptions.cs
- _NetRes.cs
- NullRuntimeConfig.cs
- UnsafeCollabNativeMethods.cs
- InvokeMethodActivity.cs
- SymbolMethod.cs
- FontStyles.cs
- SqlTypeSystemProvider.cs
- FileDialog.cs