Sync Center

Windows Vista introduces Sync Center, which enables users to synchronize their data with other computers and devices from one common user interface. There are several ways to interact with Sync Center, one of which is as a provider of synchronization information. Synchronization information is defined as both:

A synchronization engine.

The data that it synchronizes.

Such a provider is called a "handler" or a "partnership."

This section covers the benefits of providing synchronization information to Sync Center.

Advantages of Sync Center

In the past, many applications and devices provided their own user interface for data synchronization, which caused the following problems for users:

The user Interface for a data synchronization application was hard to discover.

The process for beginning synchronization differed among applications and devices.

Conflict resolution differed among applications and devices.

There was no central way to discover what data had been synchronized.

Sync Center is a centralized UI from which users can carry out the following tasks:

View all synchronization applications

Setup new synchronization applications

Perform and schedule synchronization

View synchronization results

View and resolve conflicts

View errors

Building your partnership to work with Sync Center

Sync Center introduces a new API that enables developers to add synchronization information to the common user interface. Applications and devices that use Sync Center ensure that users can synchronize their data from a central UI, eliminating the need for each application to implement their own UI. Sync Center includes the following features:

A fully customizable common user interface from which users can synchronize all their data.

Feedback to the user about the data that has been synchronized.

Synchronization conflicts can be persisted and resolved later. A conflict does not block synchronization.

Conflict resolution is the same for all devices and applications.

Although Sync Center provides a common user interface, applications can extend the UI to provide their own information as needed. Sync Center is part of the Windows Shell and therefore developers can:

Customize the name, description and icon of the handler that appears in the Sync Center.

Provide custom user interface when the user performs an operation such as synchronizing the data, scheduling synchronization, or enabling a partnership.

Provide a custom UI for conflict resolution.

Create additional property sheets for a handler and items.

Extend context menus.

Design decisions to consider

Answering the following questions will help you determine how to take full advantage of Sync Center as you implement your partnership.

What is the target of synchronization?

The Sync Center provides a common UI, regardless of the type of partnership. Whether the user is synchronizing a device such as a media player, or files between two computers, the UI is similar. Handlers should implement the following interfaces:

ISyncMgrHandlerInfo: The Sync Center uses these methods to get information about the handler, such as the handler's category In the UI, each application is assigned a category and applications can be grouped according to category. Setting the category correctly will help users identify your partnership. This interface exposes other information, such as the last time the handler was synchronized.

What kinds of data are synchronized?

The Sync Center enables you to determine how to present the data in the UI. Each item in the handler's ISyncMgrSyncItemContainer is shown in the partnership's folder. A sync item typically represents a group of data, such as a folder that contains several files. Each item should implement the following interfaces:

ISyncMgrSyncItemInfo: Exposes methods that provide property and state information for a single sync item.

How many instances of your handler will there be?

Consider the example of a data synchronization application for a portable media player. One household might contain two or more media players of the same kind that are synchronized on the same computer. In this case, there might be more than one handler in the Sync Center. The author of a sync handler implements the ISyncMgrHandlerCollection interface to support multiple devices or computers and sync their details independently. Sync Center uses the handler collection to request instantiation of individual sync handlers. ISyncMgrHandlerCollection also enables a sync handler author to add handlers dynamically to Sync Center as opposed to registering each one individually in the registry.

Do you need to provide additional UI?

Sync Center enables you to provide your own UI in several key scenarios. The ISyncMgrUIOperation interface provides a sync handler or item with a way to display UI when requested by Sync Center. Implementing this as a separate interface enables UI to be performed independently of synchronization. This interface should be implemented on a different object from the handler interface (ISyncMgrHandler) or item interface (ISyncMgrSyncItem).

Do you need to handle conflicts?

If your partnership supports two-way synchronization-that is, the data can be changed on either end of the partnership-it will need to handle cases where the same data has been changed in both places. Sync Center provides a common UI where conflicts are reported. The ISyncMgrConflictStore interface enables a handler to provide conflicts which show up in the Conflicts folder.

What events are reported to users?

A handler can report events-such as errors, warnings, and informational messages-to Sync Center, which stores the events and displays them in a common UI. To store the events yourself, implement the ISyncMgrEventStore interface. Sync Center persists events only during the current user's session. You can implement ISyncMgrEventStore to persist events longer. Implementing the ISyncMgrEventStore is also useful for components that already log events. The event store is then written to simply translate events to a form that Sync Center can use.

Do you need to extend the folder UI?

Sync Center displays the basic properties of partnerships and items. If your handler has other information you want to display or has configuration settings you want to expose, implement the IShellPropSheetExtinterface and register the component against the handler or sync item.

What is the target of synchronization?

The Sync Center provides a common UI, regardless of the type of partnership. Whether the user is synchronizing a device such as a media player, or files between two computers, the UI is similar. Handlers should implement the following interfaces:

ISyncMgrHandlerInfo: The Sync Center uses these methods to get information about the handler, such as the handler's category In the UI, each application is assigned a category and applications can be grouped according to category. Setting the category correctly will help users identify your partnership. This interface exposes other information, such as the last time the handler was synchronized.

What kinds of data are synchronized?

The Sync Center enables you to determine how to present the data in the UI. Each item in the handler's ISyncMgrSyncItemContainer is shown in the partnership's folder. A sync item typically represents a group of data, such as a folder that contains several files. Each item should implement the following interfaces:

ISyncMgrSyncItemInfo: Exposes methods that provide property and state information for a single sync item.

How many instances of your handler will there be?

Consider the example of a data synchronization application for a portable media player. One household might contain two or more media players of the same kind that are synchronized on the same computer. In this case, there might be more than one handler in the Sync Center. The author of a sync handler implements the ISyncMgrHandlerCollection interface to support multiple devices or computers and sync their details independently. Sync Center uses the handler collection to request instantiation of individual sync handlers. ISyncMgrHandlerCollection also enables a sync handler author to add handlers dynamically to Sync Center as opposed to registering each one individually in the registry.

Do you need to provide additional UI?

Sync Center enables you to provide your own UI in several key scenarios. The ISyncMgrUIOperation interface provides a sync handler or item with a way to display UI when requested by Sync Center. Implementing this as a separate interface enables UI to be performed independently of synchronization. This interface should be implemented on a different object from the handler interface (ISyncMgrHandler) or item interface (ISyncMgrSyncItem).

Do you need to handle conflicts?

If your partnership supports two-way synchronization-that is, the data can be changed on either end of the partnership-it will need to handle cases where the same data has been changed in both places. Sync Center provides a common UI where conflicts are reported. The ISyncMgrConflictStore interface enables a handler to provide conflicts which show up in the Conflicts folder.

What events are reported to users?

A handler can report events-such as errors, warnings, and informational messages-to Sync Center, which stores the events and displays them in a common UI. To store the events yourself, implement the ISyncMgrEventStore interface. Sync Center persists events only during the current user's session. You can implement ISyncMgrEventStore to persist events longer. Implementing the ISyncMgrEventStore is also useful for components that already log events. The event store is then written to simply translate events to a form that Sync Center can use.

Do you need to extend the folder UI?

Sync Center displays the basic properties of partnerships and items. If your handler has other information you want to display or has configuration settings you want to expose, implement the IShellPropSheetExtinterface and register the component against the handler or sync item.

Threading

Sync Center creates the handler a background thread and therefore the ISyncMgrHandler.Synchronize method can take as long as needed to synchronize the data. Simply returning from the Synchronize method tells Sync Center that it is done. If the handler wants to perform synchronization in parallel, it may do so by creating multiple threads to perform the synchronization.

Background synchronization

Some applications already provide a UI outside of Sync Center for managing their synchronization. Other applications may want to provide automatic background synchronization that is external to Sync Center. If an external application performs the synchronization, merely start that application in Synchronize and return. The external application then creates the CLSID_SyncMgrClient object by passing the CLSCTX_SERVER flag and the ISyncMgrSessionCreator interface identifier (IID) to CoCreateInstance. It uses that object to create a session to report sync progress and state.

By creating a ISyncMgrSessionCreator in your external synchronization application, you can take advantage of Sync Center's consistent, centralized user experience without having to refactor your sync engine.

Compatibility with Windows XP

Synchronization tools written for the Synchronization Manager will automatically appear in the sync center but won't take advantage of the new features, such as the centralized error reporting and conflict resolution. To take advantage of the error reporting and conflict resolution UI, implement the ISyncMgrEventStore and ISyncMgrConflictStore interfaces, respectively.