UpdateControllerApplyUpdate Method (ApplyUpdateOptions, IDictionary) |
Namespace: Kjs.AppLife.Update.Controller
public bool ApplyUpdate( ApplyUpdateOptions options, IDictionary initialSharedProperties )
Exception | Condition |
---|---|
InvalidEnumArgumentException | options represents a combination of flags not defined in the ApplyUpdateOptions enumeration. |
ArgumentException | options contains both the NoUpdateWindow and AutoClose values. |
InvalidOperationException | CurrentUpdate was . To set CurrentUpdate, use CheckForUpdate, CheckForUpdateAsync, or ShowCheckForUpdateDialog. -or- The value of IsDownloaded was for CurrentUpdate. This value is set after DownloadUpdate, DownloadUpdateAsync, or ShowDownloadUpdateDialog completes. -or- IsBusy was . -or- The PublicKeyToken property was set to a public key from one of the Quick Start examples that comes with AppLife Update, and the application being updated is not the matching Quick Start. |
ValidationException | The update could not be validated. -or- The update was not valid according to its signature obtained from director.xml and the key specified in PublicKeyToken. Check InnerException for the error that occurred. |
UpdateException | The update could not be applied. Check InnerException for the error that occurred. |
InstanceShutdownException | One or more running instances of the application did not respond to the controller's request to shut down (UpdateStarting). -or- All instances responded to the request to shut down, but at least one besides the current instance remains open and current instance is not running with administrative privileges. |
This method applies an update that has already been downloaded. Internally, it calls ValidateUpdate before applying the update. The update must have already been downloaded using DownloadUpdate, DownloadUpdateAsync, or ShowDownloadUpdateDialog.
This method raises the UpdateStarting event on the controllers in all running instances of the application. If any of those controllers set Response to CancelUpdate, this method returns and the update is not applied.
If the update process is started successfully, this method calls Environment.Exit and does not return.
If initialSharedProperties is specified, the dictionary and all keys and values in it must be serializable types referenced in the update. For example, using a Hashtable for the dictionary and strings for the keys and values will work, but using a value that is an instance of a custom type in the current application will only work if the assembly containing that type is part of the update and included as a reference (either as a custom action assembly or as a dynamic action reference).
To access values in initialSharedProperties from Set Shared Property actions or in Action Conditions, their keys must be strings.