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
- XmlSchemaComplexType.cs
- ObjectPersistData.cs
- RelativeSource.cs
- DatatypeImplementation.cs
- MiniAssembly.cs
- TransformerInfo.cs
- TextTreeTextBlock.cs
- SqlXmlStorage.cs
- LayoutExceptionEventArgs.cs
- SqlParameterCollection.cs
- SaveFileDialogDesigner.cs
- URI.cs
- AdapterUtil.cs
- Trace.cs
- rsa.cs
- ComponentDispatcherThread.cs
- StringKeyFrameCollection.cs
- GlyphingCache.cs
- RightNameExpirationInfoPair.cs
- BitmapSizeOptions.cs
- SchemaNotation.cs
- KeyboardNavigation.cs
- SqlMultiplexer.cs
- ObjectPropertyMapping.cs
- InkCollectionBehavior.cs
- HTMLTagNameToTypeMapper.cs
- SoapEnumAttribute.cs
- HierarchicalDataSourceDesigner.cs
- DbTransaction.cs
- XmlSchemaElement.cs
- RepeaterItem.cs
- AspNetSynchronizationContext.cs
- FileDialog_Vista_Interop.cs
- XmlNamespaceManager.cs
- CompensationDesigner.cs
- AnnotationResourceCollection.cs
- BufferedOutputStream.cs
- ForeignConstraint.cs
- HyperLinkColumn.cs
- HttpException.cs
- ConfigurationManagerHelper.cs
- ExpressionContext.cs
- OverflowException.cs
- StringFormat.cs
- SortDescriptionCollection.cs
- MenuAutomationPeer.cs
- HttpConfigurationContext.cs
- TextProperties.cs
- MultiBinding.cs
- TextBoxBase.cs
- LinqDataSourceDisposeEventArgs.cs
- CapiSafeHandles.cs
- SmtpException.cs
- HttpListenerException.cs
- HtmlWindowCollection.cs
- DownloadProgressEventArgs.cs
- SessionState.cs
- ChangeNode.cs
- IPEndPointCollection.cs
- DataPagerCommandEventArgs.cs
- OleDbTransaction.cs
- CodeMemberEvent.cs
- WebContentFormatHelper.cs
- ProviderBase.cs
- ServiceChannelManager.cs
- CustomCategoryAttribute.cs
- FormViewModeEventArgs.cs
- DetailsViewInsertedEventArgs.cs
- ChtmlTextWriter.cs
- AsymmetricKeyExchangeFormatter.cs
- HtmlTableRow.cs
- BigInt.cs
- DictionaryTraceRecord.cs
- FilterElement.cs
- ControlPropertyNameConverter.cs
- NonceToken.cs
- RewritingPass.cs
- HttpRequestCacheValidator.cs
- UpdateEventArgs.cs
- ChannelServices.cs
- ItemCheckEvent.cs
- ListBoxItemAutomationPeer.cs
- _SecureChannel.cs
- DataError.cs
- _BufferOffsetSize.cs
- OptimalBreakSession.cs
- SimpleMailWebEventProvider.cs
- CapabilitiesRule.cs
- XMLDiffLoader.cs
- EdmToObjectNamespaceMap.cs
- ModulesEntry.cs
- CompilerCollection.cs
- AttributeUsageAttribute.cs
- EventLogTraceListener.cs
- CollectionView.cs
- RequestSecurityTokenResponse.cs
- DesignerDataTableBase.cs
- RadioButtonAutomationPeer.cs
- StrokeCollectionDefaultValueFactory.cs
- TypeUtil.cs