internal void Apply(FileDialogNative.IFileDialog dialog)
        {
            //Walk backwards
            for (int i = this.Items.Count - 1; i >= 0; --i)
            {
                FileDialogCustomPlace customPlace = this.Items[i];

                // Fix for Dev10 bug 536188: we need permission to check whether the specified path exists
                FileIOPermission permission = new FileIOPermission(FileIOPermissionAccess.PathDiscovery, customPlace.Path);
                permission.Demand();

                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).
            }
        }
 internal void Apply(FileDialogNative.IFileDialog dialog)
 {
     for (int i = base.Items.Count - 1; i >= 0; i--)
     {
         FileDialogCustomPlace place = base.Items[i];
         new FileIOPermission(FileIOPermissionAccess.PathDiscovery, place.Path).Demand();
         try
         {
             FileDialogNative.IShellItem nativePath = place.GetNativePath();
             if (nativePath != null)
             {
                 dialog.AddPlace(nativePath, 0);
             }
         }
         catch (FileNotFoundException)
         {
         }
     }
 }
コード例 #3
0
        internal void Apply(FileDialogNative.IFileDialog dialog)
        {
            //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).
            }
        }