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
- TextBounds.cs
- RefreshPropertiesAttribute.cs
- SoapObjectReader.cs
- XmlEntity.cs
- ObjectSpanRewriter.cs
- OleDbSchemaGuid.cs
- SqlUserDefinedAggregateAttribute.cs
- SecureStringHasher.cs
- X509Logo.cs
- EntityViewGenerator.cs
- IListConverters.cs
- ViewStateException.cs
- WaveHeader.cs
- NavigationExpr.cs
- IOThreadScheduler.cs
- HttpFileCollection.cs
- RandomDelayQueuedSendsAsyncResult.cs
- ManagementQuery.cs
- JsonWriter.cs
- PropertyGridEditorPart.cs
- SqlDataSourceQueryEditorForm.cs
- Version.cs
- RuleConditionDialog.cs
- SimpleTableProvider.cs
- SettingsPropertyCollection.cs
- Point3DKeyFrameCollection.cs
- MenuItemStyle.cs
- DataGridViewLinkCell.cs
- ConnectionPoolManager.cs
- EncryptedKeyIdentifierClause.cs
- MouseButtonEventArgs.cs
- TextFormatterContext.cs
- ClientSettingsSection.cs
- GridViewDeleteEventArgs.cs
- TypeBrowser.xaml.cs
- CultureData.cs
- FileSecurity.cs
- XmlQueryContext.cs
- WorkflowApplicationUnloadedException.cs
- SqlSupersetValidator.cs
- HtmlHistory.cs
- EntityCodeGenerator.cs
- TreeView.cs
- TimerEventSubscriptionCollection.cs
- AsymmetricKeyExchangeFormatter.cs
- DesignerVerbCollection.cs
- CodeDOMProvider.cs
- DataGridViewAdvancedBorderStyle.cs
- invalidudtexception.cs
- DataObject.cs
- SwitchElementsCollection.cs
- WorkflowInstanceRecord.cs
- AssociationProvider.cs
- Transform3D.cs
- EdmItemCollection.cs
- DeviceSpecificChoice.cs
- DrawingImage.cs
- WpfGeneratedKnownProperties.cs
- EDesignUtil.cs
- ReadOnlyHierarchicalDataSourceView.cs
- Helpers.cs
- DefaultTextStore.cs
- ListViewUpdateEventArgs.cs
- InfoCardTraceRecord.cs
- AvtEvent.cs
- ProcessHost.cs
- StopStoryboard.cs
- MethodToken.cs
- WorkflowRuntime.cs
- PictureBox.cs
- PrintControllerWithStatusDialog.cs
- LocationSectionRecord.cs
- TabPanel.cs
- CodePageUtils.cs
- RelatedCurrencyManager.cs
- DateTime.cs
- WebPartConnectionsCancelVerb.cs
- HyperLinkStyle.cs
- DoubleIndependentAnimationStorage.cs
- Rotation3DAnimation.cs
- OleDbDataAdapter.cs
- ResourceDictionaryCollection.cs
- Int32KeyFrameCollection.cs
- IssuanceLicense.cs
- MessageBox.cs
- SynchronizedDispatch.cs
- Message.cs
- SortExpressionBuilder.cs
- AsnEncodedData.cs
- DropDownList.cs
- MethodCallTranslator.cs
- WindowsListViewGroupHelper.cs
- CodeMethodInvokeExpression.cs
- AttributeUsageAttribute.cs
- SessionIDManager.cs
- NetworkInterface.cs
- LessThanOrEqual.cs
- PageTheme.cs
- SortQuery.cs
- GenericUI.cs