Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / FileDialogCustomPlacesCollection.cs / 4 / 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
- COM2FontConverter.cs
- DesignerFrame.cs
- FixedTextSelectionProcessor.cs
- HiddenFieldDesigner.cs
- HtmlUtf8RawTextWriter.cs
- CachedPathData.cs
- RootProfilePropertySettingsCollection.cs
- XmlSchemaSubstitutionGroup.cs
- EventLogInternal.cs
- AssemblyCache.cs
- ObjectHelper.cs
- PermissionSetEnumerator.cs
- SchemaDeclBase.cs
- EventHandlerList.cs
- SqlColumnizer.cs
- Window.cs
- RegexMatch.cs
- TreeNode.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- RoleManagerEventArgs.cs
- DoubleAnimationUsingKeyFrames.cs
- ImageMapEventArgs.cs
- ReadOnlyAttribute.cs
- SignatureHelper.cs
- InternalBufferManager.cs
- String.cs
- PasswordPropertyTextAttribute.cs
- SamlSecurityTokenAuthenticator.cs
- DependencyProperty.cs
- WmlTextViewAdapter.cs
- StandardOleMarshalObject.cs
- DESCryptoServiceProvider.cs
- UInt64Storage.cs
- BulletDecorator.cs
- SpeechEvent.cs
- ScriptServiceAttribute.cs
- InstanceView.cs
- HttpModuleAction.cs
- ExcludeFromCodeCoverageAttribute.cs
- TextBoxAutoCompleteSourceConverter.cs
- TrackingRecordPreFilter.cs
- DataSourceCacheDurationConverter.cs
- LogWriteRestartAreaAsyncResult.cs
- UnlockInstanceAsyncResult.cs
- FileLoadException.cs
- MimeParameterWriter.cs
- OperationAbortedException.cs
- DotAtomReader.cs
- EpmContentDeSerializer.cs
- RequestStatusBarUpdateEventArgs.cs
- CollectionChangedEventManager.cs
- InternalConfigConfigurationFactory.cs
- ProcessThreadCollection.cs
- FlowSwitchDesigner.xaml.cs
- TypeSchema.cs
- HotCommands.cs
- InputBindingCollection.cs
- DataGridViewCellStateChangedEventArgs.cs
- TemplateXamlParser.cs
- IntegerFacetDescriptionElement.cs
- WithParamAction.cs
- ApplicationBuildProvider.cs
- BulletChrome.cs
- HandlerMappingMemo.cs
- LiteralControl.cs
- Attributes.cs
- _HeaderInfo.cs
- StreamingContext.cs
- MetaModel.cs
- SystemUdpStatistics.cs
- UnsafeCollabNativeMethods.cs
- SafePointer.cs
- CompositeDataBoundControl.cs
- SqlCommand.cs
- BitmapEffectOutputConnector.cs
- InternalResources.cs
- MetabaseServerConfig.cs
- TagMapCollection.cs
- SyndicationFeedFormatter.cs
- RichTextBox.cs
- CustomErrorsSectionWrapper.cs
- QueryGenerator.cs
- FastEncoder.cs
- WindowsListView.cs
- Gdiplus.cs
- SystemInfo.cs
- TextDecoration.cs
- SafeWaitHandle.cs
- RootDesignerSerializerAttribute.cs
- CodeDomSerializerException.cs
- GridSplitter.cs
- ClipboardProcessor.cs
- IndexingContentUnit.cs
- SystemIcmpV4Statistics.cs
- DefaultPrintController.cs
- ToolboxComponentsCreatedEventArgs.cs
- WebControlsSection.cs
- MatrixCamera.cs
- StrokeRenderer.cs
- RequestCachePolicy.cs