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
- ConfigurationSectionHelper.cs
- ContextStaticAttribute.cs
- XslTransformFileEditor.cs
- ValueSerializerAttribute.cs
- BindingExpressionUncommonField.cs
- CustomAttributeFormatException.cs
- HtmlInputPassword.cs
- SerializerDescriptor.cs
- HwndStylusInputProvider.cs
- ApplicationSettingsBase.cs
- _ProxyRegBlob.cs
- EventSchemaTraceListener.cs
- FileLogRecordHeader.cs
- BitArray.cs
- ApplicationSettingsBase.cs
- CatalogZoneBase.cs
- TypographyProperties.cs
- HandlerWithFactory.cs
- ScrollChrome.cs
- BypassElementCollection.cs
- StringOutput.cs
- EntityDataSourceSelectingEventArgs.cs
- EventManager.cs
- IgnoreSection.cs
- TriggerActionCollection.cs
- HiddenFieldDesigner.cs
- DataList.cs
- WCFModelStrings.Designer.cs
- DoubleLink.cs
- VectorCollectionValueSerializer.cs
- HttpClientCertificate.cs
- ManagementQuery.cs
- XmlReflectionMember.cs
- DbTransaction.cs
- Page.cs
- SystemSounds.cs
- DrawingCollection.cs
- PieceDirectory.cs
- SafeLocalMemHandle.cs
- SspiSecurityToken.cs
- ExpressionContext.cs
- QilStrConcat.cs
- TextDecorations.cs
- BooleanExpr.cs
- FeatureAttribute.cs
- ScriptReference.cs
- WebScriptEndpoint.cs
- BookmarkWorkItem.cs
- NullReferenceException.cs
- Geometry3D.cs
- CheckedPointers.cs
- SchemaObjectWriter.cs
- TraceSection.cs
- ScrollBar.cs
- HttpResponse.cs
- FontResourceCache.cs
- Completion.cs
- CmsInterop.cs
- DataColumnChangeEvent.cs
- HatchBrush.cs
- DataReceivedEventArgs.cs
- Trigger.cs
- IfAction.cs
- CatalogPart.cs
- NullRuntimeConfig.cs
- URI.cs
- BitmapEffectGroup.cs
- AppDomain.cs
- SocketElement.cs
- EmissiveMaterial.cs
- RequestQueue.cs
- BindingNavigator.cs
- SocketElement.cs
- DoubleAnimationUsingPath.cs
- SoapIgnoreAttribute.cs
- EditingMode.cs
- EntityChangedParams.cs
- ScrollBar.cs
- X509WindowsSecurityToken.cs
- XmlAttributeProperties.cs
- DiscoveryServiceExtension.cs
- HostingPreferredMapPath.cs
- EmptyEnumerator.cs
- HttpVersion.cs
- WindowsListViewGroup.cs
- SingleObjectCollection.cs
- DbParameterCollectionHelper.cs
- AccessViolationException.cs
- SchemaUtility.cs
- BookmarkScopeInfo.cs
- StrongNameIdentityPermission.cs
- autovalidator.cs
- Pair.cs
- COM2ExtendedBrowsingHandler.cs
- AttachedAnnotation.cs
- EncoderNLS.cs
- DesignerAdRotatorAdapter.cs
- StylusEditingBehavior.cs
- HtmlTableRowCollection.cs
- SystemWebSectionGroup.cs