IExternal |
void OnServersChanged( Document document, ServerChangeCause cause, IList<Guid> oldServers )
This method may only be invoked in a recordable service. Services registered as non-recordable never receive this call.
It is imperative to understand this method is not called just when an active server (or servers) is (are) changed for a service. It is invoked only when the active server is changed so it is different from those previously used (i.e. actually executed) in a document. Because of that, this notification is never sent when active server is set or reset in a document in which the service was never executed before.
If a document has explicitly set active server (or servers), OnServersChanged is never called for that document when the application-wide active server (servers) gets changed. The document would still be executed with its own active servers applied. A similar case is when the active server (servers) is unset for a document but the currently active application-wide server happens to be the same as the one that was set in the document.It is up to the service provider to decide what should be the appropriate action. In some cases, if not all, the service will probably want to execute again, now with the new active server(s), but that it is not necessary - the service invoker may as well decide to wait for the end-user to trigger execution if the service (e.g. by clicking a corresponding command in the menu.)