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
- DataObjectCopyingEventArgs.cs
- TouchFrameEventArgs.cs
- HandlerMappingMemo.cs
- FormViewModeEventArgs.cs
- MenuCommandService.cs
- ModelTreeManager.cs
- ServiceRoute.cs
- WindowsNonControl.cs
- GridViewHeaderRowPresenter.cs
- Context.cs
- FixedSOMTable.cs
- XmlEncoding.cs
- OleDbWrapper.cs
- SecurityAlgorithmSuiteConverter.cs
- ScriptControlDescriptor.cs
- BindingSource.cs
- WinFormsUtils.cs
- Size.cs
- TagPrefixAttribute.cs
- PasswordPropertyTextAttribute.cs
- GeneratedCodeAttribute.cs
- SqlReferenceCollection.cs
- WmfPlaceableFileHeader.cs
- XmlNodeComparer.cs
- TileBrush.cs
- _Semaphore.cs
- CrossContextChannel.cs
- AccessibleObject.cs
- ObjectViewEntityCollectionData.cs
- ResourceExpressionBuilder.cs
- ConnectionStringSettingsCollection.cs
- SizeLimitedCache.cs
- CacheAxisQuery.cs
- WorkflowItemsPresenter.cs
- BinaryUtilClasses.cs
- HwndSubclass.cs
- ScrollBar.cs
- HandlerBase.cs
- ButtonField.cs
- EdmMember.cs
- BinaryMessageEncodingBindingElement.cs
- InfiniteIntConverter.cs
- DispatchChannelSink.cs
- ModifiableIteratorCollection.cs
- DataViewListener.cs
- List.cs
- SimpleTypeResolver.cs
- BreakSafeBase.cs
- Action.cs
- serverconfig.cs
- AssemblyHash.cs
- TCPClient.cs
- MatrixStack.cs
- SqlServices.cs
- SerTrace.cs
- BrowserTree.cs
- InheritanceService.cs
- ValidationRuleCollection.cs
- HtmlInputRadioButton.cs
- EventLogEntry.cs
- ValidatedControlConverter.cs
- HttpApplicationStateWrapper.cs
- WindowsGraphics2.cs
- ProgressBarRenderer.cs
- RenderCapability.cs
- RIPEMD160Managed.cs
- MouseActionConverter.cs
- SynchronizationValidator.cs
- ExpressionBuilderCollection.cs
- SuppressMergeCheckAttribute.cs
- InkPresenterAutomationPeer.cs
- SqlProfileProvider.cs
- VectorAnimationBase.cs
- ConnectionPoolManager.cs
- SEHException.cs
- securitycriticaldataClass.cs
- ResourceReader.cs
- NavigationHelper.cs
- DynamicQueryStringParameter.cs
- SessionStateSection.cs
- PreviewKeyDownEventArgs.cs
- FileRecordSequenceCompletedAsyncResult.cs
- Executor.cs
- CountdownEvent.cs
- AutomationPatternInfo.cs
- MulticastIPAddressInformationCollection.cs
- ExtensionFile.cs
- UrlMappingsModule.cs
- PropertyPushdownHelper.cs
- RefType.cs
- NameValueFileSectionHandler.cs
- XNodeValidator.cs
- FormViewUpdatedEventArgs.cs
- WaitHandle.cs
- ManipulationCompletedEventArgs.cs
- log.cs
- InputScopeConverter.cs
- Buffer.cs
- TextViewSelectionProcessor.cs
- Pair.cs