-
Notifications
You must be signed in to change notification settings - Fork 262
Details on Using Selected ATF Components
This section discusses details of how to use specific ATF components, using examples to illustrate. For a general discussion, see Using ATF Components.
This component requires:
-
CommandService
,DocumentRegistry
,FileDialogService
, andStatusService
components. - Component that exports
IDocumentClient
.
The ATF Simple DOM Editor Sample uses StandardFileCommands
. Examining this sample's Program.cs
file shows that it also includes the ATF components in its MEF catalog to meet the other import requirements: CommandService
, DocumentRegistry
, FileDialogService
, and StatusService
(link to source).
This sample also provides an Editor
component that exports and implements the IDocumentClient
interface. Here is the Editor
component class declaration (link to source):
[Export(typeof(IDocumentClient))]
[Export(typeof(Editor))]
[Export(typeof(IInitializable))]
[PartCreationPolicy(CreationPolicy.Shared)]
public class Editor : IDocumentClient, IControlHostClient, IInitializable
Editor
's implementation of IDocumentClient
(link to source):
#region IDocumentClient Members
/// <summary>
/// Gets information about the document client, such as the file type and file
/// extensions it supports, whether or not it allows multiple documents to be open, etc.</summary>
public DocumentClientInfo Info
{
get { return DocumentClientInfo; }
}
...
/// <summary>
/// Closes the document and removes any views of it from the UI</summary>
/// <param name="document">Document to close</param>
public void Close(IDocument document)
{
EventSequenceContext context = Adapters.As<EventSequenceContext>(document);
m_controlHostService.UnregisterControl(context.ListView);
context.ControlInfo = null;
// close all active EditingContexts in the document
foreach (DomNode node in context.DomNode.Subtree)
foreach (EditingContext editingContext in node.AsAll<EditingContext>())
m_contextRegistry.RemoveContext(editingContext);
// close the document
m_documentRegistry.Remove(document);
}
#endregion
For
Along with StandardFileExitCommand
, add CommandService
to the MEF TypeCatalog
. For a discussion of why this is required, see Functionality Required From Other Components.
- What is MEF: Brief description of MEF with links to more detailed information.
- How MEF is Used in ATF: Examine how ATF is used in sample applications to compose components and how components are decorated.
- Initializing Components: How component initialization is implemented in ATF.
- Using ATF Components: How to use ATF components, discovering what you need to provide in your application.
- Creating MEF Components: How to create components of your own, using the attributes you need.
- Important ATF Components: Description of some key ATF components in functional areas as well as some components in sample applications.
- Finding ATF Components: How to find components you need for your application.
- Details on Selected ATF Components: Provides more details on some ATF components you might want to use in your applications.
- Details on Using Selected ATF Components: Shows exactly how to use certain components.
- 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