-
Notifications
You must be signed in to change notification settings - Fork 263
Document Handling Components
Several ATF components provide services document handlers can use.
Many of the sample applications use all of these components. Some of these components depend on each other, as noted in the discussion below on component requirements.
As previously discussed, the DocumentRegistry
component tracks open documents (objects implementing IDocument
) for an application and implements IDocumentRegistry
.
To use this component, simply add it to the application's MEF catalog. It doesn't import anything, so no other components are required to use it.
However, other components import and require IDocumentRegistry
: StandardFileCommands
, AutoDocumentService
, and MainWindowTitleService
— the other components discussed here. Therefore, you must provide DocumentRegistry
or some other component implementing IDocumentRegistry
to use these other components. Other components besides these also import IDocumentRegistry
, such as CommandLineArgsService
, which parses and validates command line arguments. These components all need and take advantage of the document tracking services DocumentRegistry
offers.
For additional information on this component, see IDocumentRegistry Interface and DocumentRegistry Component.
StandardFileCommands
implements File menu commands that modify the document registry: New, Open, Save, SaveAs, Save All, and Close. New and Open commands are created for each IDocumentClient
component in the application.
In other words, including this component in your application automatically adds all the usual menu items you need to handle documents.
StandardFileCommands
is the only ATF component that implements IDocumentService
and can be used to satisfy such an import. For instance, the AutoDocumentService
component imports IDocumentService
.
StandardFileCommands
requires (except as noted) the following:
-
DocumentRegistry
component or some other component implementingIDocumentRegistry
. -
CommandService
component or component implementingICommandService
. -
FileDialogService
component or component implementingIFileDialogService
. -
StatusService
component or component implementingIStatusService
(requested but not required). -
IDocumentClient
implementer for each document type.
IDocumentClient
. The application must implement IDocumentClient
for every document type it supports. For details on doing this, see Implementing a Document and Its Client.
Note that the application can implement as many IDocumentClient
implementers as it wishes, because of the form of the import:
[ImportMany]
private Lazy<IDocumentClient>[] m_documentClients;
For an example of using StandardFileCommands
in an application, see StandardFileCommands.
When an application starts up, AutoDocumentService
automatically opens the application's last open document or a new, empty document.
AutoDocumentService
requires the following (except as noted):
-
DocumentRegistry
component or some other component implementingIDocumentRegistry
. -
SettingsService
component or component implementingISettingsService
(requested but not required). -
CommandLineArgsService
component (requested but not required). -
IDocumentService
implementer, such asStandardFileCommands
, to open an existing document. -
IMainWindow
implementer, which is met by creating aMainForm
component. -
Form
implementer, which is met by creating aMainForm
component. -
IDocumentClient
implementer for each document type to open a document.
MainForm
derives from Form
and implements IMainWindow
, so it satisfies two of the imports, as noted.
The last requirement is the most demanding: the application must implement IDocumentClient
for every document type it supports. For details on doing this, see Implementing a Document and Its Client. Just as for StandardFileCommands
, the application can have as many IDocumentClient
implementers as it wants.
MainWindowTitleService
updates the application main form's title to reflect the current document and indicate whether it is dirty or not.
MainWindowTitleService
requires the following:
-
DocumentRegistry
component or some other component implementingIDocumentRegistry
. -
IMainWindow
implementer, which is met by creating aMainForm
component.
-
What is a Document in ATF: Introduces the
IDocument
andIDocumentClient
interfaces that an individual document uses. -
Document Registry and Services: Discusses the
DocumentRegistry
to track documents and other document services offered inIDocumentService
. - Document Handling Components: Details the MEF components providing services document handlers need.
-
Implementing a Document and Its Client: Shows how to implement both
IDocument
andIDocumentClient
interfaces for a document type.
- Home
- Getting Started
- Features & Benefits
- Requirements & Dependencies
- Gallery
- Technology & Samples
- Adoption
- News
- Release Notes
- ATF Community
- Searching Documentation
- Using Documentation
- Videos
- Tutorials
- How To
- Programmer's Guide
- Reference
- Code Samples
- Documentation Files
© 2014-2015, Sony Computer Entertainment America LLC