Skip to content

Other ATF Services

Gary edited this page Aug 27, 2014 · 1 revision

Table of Contents

Document Services

ATF offers a Document Framework that supports using documents for application data.

Interfaces

These interfaces handle document services:

  • IDocument: provide read-only and dirty properties.
  • IDocumentService: provide document commands, such as Open, Close, Save, and Save As. These commands use the IDocumentClient implementation for a particular client to handle documents. Notifications allow tracking what the user is doing with the document.
  • IDocumentRegistry: interface for the document registry, which holds documents, provides notifications when a document is added or removed, tracks the most recently active document and the open document contexts, and filters by document type.
  • IDocumentClient: perform the actual open, close, and display methods for a client. Applications should implement a document client implementing IDocumentClient for every document type they handle.

Components

The following components provide menus, a document registry, and other services:

  • StandardFileCommands: implement File menu commands that modify the document registry: New, Open, Save, SaveAs, Save All, and Close.
  • AutoDocumentService: open documents from the previous application session or create an empty document when an application starts.
  • RecentDocumentCommands: add recently opened documents to the application's File > Recent Documents submenu.
  • DocumentRegistry: track open documents in an application. It can retrieve the active document or most recently active document of a given type.
  • MainWindowTitleService: update the main dialog's title to reflect the current document and its state, that is, modified or not.
For more information, see Documents in ATF.

File Dialog Service

The FileDialogService component implements IFileDialogService, which contains methods to manage standard file dialogs. FileDialogService has file dialogs — for single and multiple files — and a save dialog. The dialog methods support standard file filtering and return the file path in a reference parameter.

If you use the StandardFileCommands component, you don't need to use FileDialogService directly. StandardFileCommands calls the IFileDialogService methods for these dialogs. However, you must include FileDialogService or a component that implements IFileDialogService in the MEF catalog, because StandardFileCommands imports IFileDialogService.

Help

Applications create their own component deriving from the ATF HelpAboutCommand component to display a Help dialog with a rich text message. Override the ShowHelpAbout() to customize it for the application information. Also modify the RTF file that ShowHelpAbout() uses, typically named About.rtf.

See any of the ATF Code Samples that use HelpAboutCommand for an example, such as ATF Simple DOM Editor Sample.

Resources

The Resources class contains a variety of image resources for standard images. You can use these images for command icons, cursors, and so on. You only need to reference the image resource to have it automatically embedded in your application's resources by the ResourceUtil class.

Topics in this section

Clone this wiki locally