Este artigo foi traduzido por máquina. Para visualizar o arquivo em inglês, marque a caixa de seleção Inglês. Você também pode exibir o texto Em inglês em uma janela pop-up, movendo o ponteiro do mouse sobre o texto.
Tradução
Inglês

Classe PackageStore

 

Representa uma coleção de instâncias Package específicas de aplicativos usadas em combinação com PackWebRequest.

Namespace:   System.IO.Packaging
Assembly:  PresentationCore (em PresentationCore.dll)

System.Object
  System.IO.Packaging.PackageStore

[SecurityCriticalAttribute(SecurityCriticalScope.Everything)]
public static class PackageStore

NomeDescrição
System_CAPS_pubmethodSystem_CAPS_staticAddPackage(Uri, Package)

Adiciona um Package no armazenamento.

System_CAPS_pubmethodSystem_CAPS_staticGetPackage(Uri)

Retorna o Package com um URI do repositório.

System_CAPS_pubmethodSystem_CAPS_staticRemovePackage(Uri)

Remove o Package com um URI do repositório.

The T:System.IO.Packaging.PackageStore defines a reference collections of package that are open and active in the application. Packages added to the T:System.IO.Packaging.PackageStore are accessed is by their key URI value. The T:System.IO.Packaging.PackageStore supports three common uses:

  1. Accessing T:System.IO.Packaging.PackagePart data through T:System.IO.Packaging.PackWebRequest.

  2. The application obtaining an instance of a T:System.IO.Packaging.Package given the package's URI.

  3. Accessing packages that are created and stored in a T:System.IO.MemoryStream.

To improve performance and minimize the overhead of repeated file open/close operations, the T:System.IO.Packaging.PackageStore is used to manage instances of packages accessed by T:System.IO.Packaging.PackWebRequest and directly by the application. When accessing data in a package, the T:System.IO.Packaging.Package address of a requested T:System.IO.Packaging.PackagePart P:System.IO.Packaging.PackagePart.Uri is first checked to see if the package is already defined and open in the T:System.IO.Packaging.PackageStore. If the package is defined as open in the T:System.IO.Packaging.PackageStore, requested parts can be accessed directly without repeatedly opening and closing the package for each request.

If your application opens a package with Overload:System.IO.Packaging.Package.Open, M:System.IO.Packaging.PackageStore.AddPackage(System.Uri,System.IO.Packaging.Package) can be called to add the package to the T:System.IO.Packaging.PackageStore. M:System.IO.Packaging.PackageStore.RemovePackage(System.Uri) should later be called to remove the package from the T:System.IO.Packaging.PackageStore prior to calling M:System.IO.Packaging.Package.Close.

XPS packages opened with an Overload:System.Windows.Xps.Packaging.XpsDocument.#ctor constructor are automatically added and removed from the T:System.IO.Packaging.PackageStore when the document is created and disposed. (You do not need to call M:System.IO.Packaging.PackageStore.AddPackage(System.Uri,System.IO.Packaging.Package) or M:System.IO.Packaging.PackageStore.RemovePackage(System.Uri) separately for XPS packages opened with Overload:System.Windows.Xps.Packaging.XpsDocument.#ctor constructors.)

The file I/O permissions of a package accessed through the T:System.IO.Packaging.PackageStore remains the same as the I/O permissions set on the package when it is opened. The T:System.IO.Packaging.PackageStore only provides references to the packages that have been added the store. It is up to the application to correctly open, update, and close each package.

Packages added to the T:System.IO.Packaging.PackageStore can be accessed in multithreaded environments when they are used in combination with a TLA2#tla_xaml parser such as Overload:System.Windows.Markup.XamlReader.Load.  When operating in a multithreaded environment, the application must lock the package before access.

.NET Framework
Disponível desde 3.0

Quaisquer membros estáticos públicos ( Compartilhado no Visual Basic) desse tipo são thread-safe. Não há garantia de que qualquer membro de instância seja thread-safe.

Retornar ao início
Mostrar: