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
- XmlByteStreamReader.cs
- StrongTypingException.cs
- ToolStripTextBox.cs
- XamlLoadErrorInfo.cs
- AsymmetricSignatureDeformatter.cs
- SplitterDesigner.cs
- PageCodeDomTreeGenerator.cs
- LambdaExpression.cs
- OverlappedContext.cs
- NameValuePair.cs
- ListBindableAttribute.cs
- AccessedThroughPropertyAttribute.cs
- GetPageNumberCompletedEventArgs.cs
- EntityModelBuildProvider.cs
- WorkflowFormatterBehavior.cs
- MaskedTextBoxDesigner.cs
- DbParameterCollectionHelper.cs
- HttpsHostedTransportConfiguration.cs
- NamespaceMapping.cs
- UnmanagedMarshal.cs
- DtdParser.cs
- Directory.cs
- CodeLinePragma.cs
- DesignerTransactionCloseEvent.cs
- RawStylusActions.cs
- NativeMethodsOther.cs
- DocumentAutomationPeer.cs
- MissingMethodException.cs
- ListDictionaryInternal.cs
- XmlSerializer.cs
- Guid.cs
- ByteAnimationBase.cs
- QuotedPrintableStream.cs
- RetrieveVirtualItemEventArgs.cs
- ScrollBarAutomationPeer.cs
- TransactionContext.cs
- ObjectResult.cs
- GroupJoinQueryOperator.cs
- Constraint.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- HitTestResult.cs
- ViewKeyConstraint.cs
- CalculatedColumn.cs
- DesignerObjectListAdapter.cs
- GlobalDataBindingHandler.cs
- BaseDataListPage.cs
- SafeWaitHandle.cs
- KeyValuePair.cs
- VirtualPath.cs
- ContentPresenter.cs
- InlinedAggregationOperatorEnumerator.cs
- NamespaceList.cs
- CharEnumerator.cs
- FileCodeGroup.cs
- AssemblyBuilder.cs
- TreeNodeEventArgs.cs
- InfoCardCryptoHelper.cs
- MouseGesture.cs
- XPathNavigatorReader.cs
- MetabaseSettings.cs
- CheckedListBox.cs
- filewebrequest.cs
- QuerySetOp.cs
- OleDbPropertySetGuid.cs
- EventMappingSettings.cs
- SplineKeyFrames.cs
- ThreadStateException.cs
- XamlReaderHelper.cs
- DataContext.cs
- FormatConvertedBitmap.cs
- GeometryGroup.cs
- _ScatterGatherBuffers.cs
- DuplicateWaitObjectException.cs
- ChannelCredentials.cs
- PassportAuthenticationModule.cs
- ObjectViewQueryResultData.cs
- ClientRuntime.cs
- NetWebProxyFinder.cs
- ListDataBindEventArgs.cs
- ButtonAutomationPeer.cs
- TableCell.cs
- SqlGenerator.cs
- TypeDescriptorFilterService.cs
- ValueQuery.cs
- CollectionChangedEventManager.cs
- SqlCommand.cs
- InvalidProgramException.cs
- MainMenu.cs
- CryptoProvider.cs
- ListBoxAutomationPeer.cs
- XmlEncApr2001.cs
- PointAnimation.cs
- SiteIdentityPermission.cs
- GPRECT.cs
- Asn1IntegerConverter.cs
- ApplyTemplatesAction.cs
- MatcherBuilder.cs
- SqlClientMetaDataCollectionNames.cs
- MailSettingsSection.cs
- TemplateLookupAction.cs