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
- MembershipPasswordException.cs
- WebPartsSection.cs
- ProtocolsConfigurationHandler.cs
- CalendarDateRangeChangingEventArgs.cs
- LinqDataSourceDisposeEventArgs.cs
- ObjectListGeneralPage.cs
- OrderedHashRepartitionStream.cs
- Compiler.cs
- recordstatefactory.cs
- KeysConverter.cs
- Pens.cs
- PropertyEmitter.cs
- SynchronizationLockException.cs
- ExtensionQuery.cs
- DataTemplateSelector.cs
- ReadOnlyCollectionBase.cs
- SupportsEventValidationAttribute.cs
- ProcessHostMapPath.cs
- CodeIdentifiers.cs
- MatrixValueSerializer.cs
- TextCompositionEventArgs.cs
- DocumentXPathNavigator.cs
- ICollection.cs
- ProviderBase.cs
- WorkflowServiceAttributes.cs
- DbConnectionOptions.cs
- unitconverter.cs
- SmiXetterAccessMap.cs
- FamilyMapCollection.cs
- Contracts.cs
- AxParameterData.cs
- RuntimeHelpers.cs
- AsymmetricAlgorithm.cs
- DES.cs
- BrowserInteropHelper.cs
- LocalizedNameDescriptionPair.cs
- AudioBase.cs
- IsolatedStorage.cs
- TextTreeObjectNode.cs
- ProcessManager.cs
- TraceUtility.cs
- DataSourceCacheDurationConverter.cs
- DiagnosticEventProvider.cs
- EventData.cs
- Literal.cs
- TableDetailsRow.cs
- HealthMonitoringSection.cs
- ZipIOLocalFileDataDescriptor.cs
- httpapplicationstate.cs
- HTTPNotFoundHandler.cs
- WebErrorHandler.cs
- SqlDependencyUtils.cs
- ExpressionBuilderCollection.cs
- Clipboard.cs
- LayoutManager.cs
- CounterSampleCalculator.cs
- ScopelessEnumAttribute.cs
- DataGridToolTip.cs
- ReflectionHelper.cs
- FrameworkElementAutomationPeer.cs
- EastAsianLunisolarCalendar.cs
- FixedSOMPageConstructor.cs
- MsmqProcessProtocolHandler.cs
- DataReaderContainer.cs
- TrackingMemoryStreamFactory.cs
- GroupByExpressionRewriter.cs
- PeerApplicationLaunchInfo.cs
- MappingMetadataHelper.cs
- VolatileEnlistmentState.cs
- WebPartAddingEventArgs.cs
- ProcessStartInfo.cs
- Bits.cs
- BrowserDefinitionCollection.cs
- MultiPageTextView.cs
- CalculatedColumn.cs
- HandleCollector.cs
- ToolboxBitmapAttribute.cs
- EncodingTable.cs
- SafeBitVector32.cs
- HtmlPageAdapter.cs
- WebResponse.cs
- MouseGestureConverter.cs
- MarkupExtensionParser.cs
- AnnotationStore.cs
- Ports.cs
- COAUTHINFO.cs
- TemplateContainer.cs
- DataGridViewEditingControlShowingEventArgs.cs
- DbException.cs
- SessionEndingEventArgs.cs
- Int32Converter.cs
- shaperfactory.cs
- SelectionItemProviderWrapper.cs
- SvcMapFileLoader.cs
- WindowsRebar.cs
- UnicodeEncoding.cs
- Descriptor.cs
- AttributeCollection.cs
- MetricEntry.cs
- DataGridLinkButton.cs