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
- Path.cs
- EntityDataSourceState.cs
- SelectionItemPattern.cs
- Repeater.cs
- TextTreeTextBlock.cs
- DoubleConverter.cs
- HttpRequestCacheValidator.cs
- QilReplaceVisitor.cs
- RealizationDrawingContextWalker.cs
- GregorianCalendar.cs
- XmlTextReaderImplHelpers.cs
- RedBlackList.cs
- MemberDescriptor.cs
- DateBoldEvent.cs
- Msec.cs
- ObjectTag.cs
- Marshal.cs
- ViewValidator.cs
- PerformanceCounterPermission.cs
- RequestResizeEvent.cs
- DebugView.cs
- ListBase.cs
- ValidationException.cs
- RegexRunner.cs
- PageParserFilter.cs
- Pen.cs
- HttpRequestWrapper.cs
- CatalogZoneAutoFormat.cs
- Regex.cs
- SqlBulkCopyColumnMappingCollection.cs
- FrameworkElementAutomationPeer.cs
- ISSmlParser.cs
- ValueSerializer.cs
- ConfigUtil.cs
- ServiceHttpModule.cs
- ConfigWriter.cs
- QilExpression.cs
- QilXmlReader.cs
- SchemaNamespaceManager.cs
- ConfigXmlDocument.cs
- MessageLogger.cs
- LinkUtilities.cs
- UnsafeNativeMethods.cs
- Point3DAnimationUsingKeyFrames.cs
- MetadataItemCollectionFactory.cs
- RegionInfo.cs
- CreateUserWizardStep.cs
- streamingZipPartStream.cs
- ExpressionBuilder.cs
- SqlNotificationRequest.cs
- CurrencyWrapper.cs
- ApplicationFileParser.cs
- SymbolTable.cs
- QilLoop.cs
- UnsafeNativeMethods.cs
- SystemDiagnosticsSection.cs
- DataGridViewColumn.cs
- BamlWriter.cs
- ListControlConvertEventArgs.cs
- TextParagraphCache.cs
- RepeaterCommandEventArgs.cs
- DeferrableContent.cs
- DataGridItemEventArgs.cs
- AppDomainCompilerProxy.cs
- CompiledRegexRunnerFactory.cs
- TreeViewImageKeyConverter.cs
- XmlSchemaDocumentation.cs
- _HeaderInfoTable.cs
- ValidationHelper.cs
- XmlSchemaSimpleTypeUnion.cs
- pingexception.cs
- OleDbDataReader.cs
- RangeBaseAutomationPeer.cs
- FileAuthorizationModule.cs
- DeviceContext2.cs
- AggregationMinMaxHelpers.cs
- ColorInterpolationModeValidation.cs
- SchemaObjectWriter.cs
- PageParser.cs
- ObjectRef.cs
- WindowsNonControl.cs
- FormClosedEvent.cs
- ToolStripItemEventArgs.cs
- RadioButton.cs
- Int32.cs
- HashCryptoHandle.cs
- InputMethod.cs
- WmlValidationSummaryAdapter.cs
- HashAlgorithm.cs
- EntityViewContainer.cs
- SslStream.cs
- MarshalDirectiveException.cs
- ValidationErrorCollection.cs
- DataGridPageChangedEventArgs.cs
- FrameworkContextData.cs
- UncommonField.cs
- CultureInfo.cs
- WebPartMenu.cs
- ObjectParameterCollection.cs
- DataGridViewCellPaintingEventArgs.cs