UpdateController Class |
Namespace: Kjs.AppLife.Update.Controller
The UpdateController type exposes the following members.
Name | Description | |
---|---|---|
![]() | UpdateController |
Initializes a new instance of the UpdateController class.
|
![]() | UpdateController(IContainer) |
Initializes a new instance of the UpdateController class with the specified container.
|
Name | Description | |
---|---|---|
![]() | ApplyUpdate |
Applies the downloaded update represented by CurrentUpdate. If the update is
applied, the application will shut down. If EnableAutoChaining is ,
applies all chained updates in sequence.
|
![]() | ApplyUpdate(ApplyUpdateOptions) |
Applies the downloaded update represented by CurrentUpdate. If the update is
applied, the application will shut down. If EnableAutoChaining is ,
applies all chained updates in sequence.
|
![]() | ApplyUpdate(ApplyUpdateOptions, IDictionary) |
Applies the downloaded update represented by CurrentUpdate. If the update is
applied, the application will shut down. If EnableAutoChaining is ,
applies all chained updates in sequence.
|
![]() | CancelAsync |
Cancels a pending asynchronous operation that was started by CheckForUpdateAsync
or DownloadUpdateAsync.
|
![]() | CheckForUpdate |
Searches for an available update. If an update is found, its information can
be retrieved from CurrentUpdate.
|
![]() | CheckForUpdateAsync |
Searches for an available update. If an update is found, its information can
be retrieved from CurrentUpdate. This method does not block the calling thread.
|
![]() | CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) |
![]() | Dispose | Releases all resources used by the Component. (Inherited from Component.) |
![]() | Dispose(Boolean) |
Clean up any resources being used.
(Overrides ComponentDispose(Boolean).) |
![]() | DownloadUpdate |
Downloads the update represented by CurrentUpdate, or, if
EnableAutoChaining is , every update in the
update chain.
|
![]() | DownloadUpdateAsync |
Downloads the update represented by CurrentUpdate, or, if
EnableAutoChaining is , every update in the
update chain. This method does not block the calling thread.
|
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | GetService | (Inherited from Component.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | GetUpdateChain |
Gets an array of UpdateInformation corresponding to all updates
in the current chain.
|
![]() ![]() | GetUpdateHistory |
Gets a collection of LoggedUpdate objects representing past updates
applied for the specified application ID. The information is retrieved by reading
update log files.
|
![]() | InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) |
![]() | OnCheckForUpdateCompleted |
Raises the CheckForUpdateCompleted event.
|
![]() | OnDownloadUpdateCompleted |
Raises the DownloadUpdateCompleted event.
|
![]() | OnDownloadUpdateProgressChanged |
Raises the DownloadUpdateProgressChanged event.
|
![]() | OnShutdownRequested |
Raises the ShutdownRequested event.
|
![]() | OnUpdateDialogShowing |
Raises the UpdateDialogShowing event.
|
![]() | OnUpdateFound |
Raises the UpdateFound event.
|
![]() | OnUpdateStarting |
Raises the UpdateStarting event.
|
![]() | OverrideAssemblyLocation |
Specifies a different assembly location for this application in order to allow the controller to apply updates
on behalf of another application.
|
![]() | OverrideHostProcessInfo | Obsolete.
Overrides the host process information to allow the controller to apply updates on behalf of another application
|
![]() | ReadLastUpdateInformation |
Gets information about the last update applied for this application ID.
|
![]() | SaveUpdatesToLocal |
Saves the current update and any chainable updates that have been downloaded to a local folder.
|
![]() | ShowCheckForUpdateDialog |
Searches for an available update while showing a modal dialog to the user.
|
![]() | ShowCheckForUpdateDialog(IWin32Window) |
Searches for an available update while showing a modal dialog to the user in
front of the specified object.
|
![]() | ShowCheckForUpdateDialog(ErrorDisplayLevel) |
Searches for an available update while showing a modal dialog to the user that
can show the specified amount of error information.
|
![]() | ShowCheckForUpdateDialog(IWin32Window, ErrorDisplayLevel) |
Searches for an available update while showing a modal dialog to the user that
can show the specified amount of error information in front of the specified object.
|
![]() | ShowDownloadUpdateDialog |
Downloads the update represented by CurrentUpdate while showing a modal
dialog to the user.
|
![]() | ShowDownloadUpdateDialog(IWin32Window) |
Downloads the update represented by CurrentUpdate while showing a modal
dialog to the user in front of the specified object.
|
![]() | ShowDownloadUpdateDialog(ErrorDisplayLevel) |
Downloads the update represented by CurrentUpdate while showing a modal
dialog to the user that can show the specified amount of error information.
|
![]() | ShowDownloadUpdateDialog(IWin32Window, ErrorDisplayLevel) |
Downloads the update represented by CurrentUpdate while showing a modal
dialog to the user that can show the specified amount of error information in front
of the specified object.
|
![]() | ToString | Returns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.) |
![]() | UpdateInteractive |
Uses built-in dialogs to walk the user through an entire update process.
|
![]() | UpdateInteractive(IWin32Window) |
Uses built-in dialogs to walk the user through an entire update process. The dialogs
will be shown in front of the specified object.
|
![]() | UpdateInteractive(ApplyUpdateOptions) |
Uses built-in dialogs to walk the user through an entire update process. The dialogs
will be shown in front of the specified object.
|
![]() | UpdateInteractive(ErrorDisplayLevel) |
Uses built-in dialogs to walk the user through an entire update process, showing
the specified amount of information about any error that occurs.
|
![]() | UpdateInteractive(IWin32Window, ErrorDisplayLevel) |
Uses built-in dialogs to walk the user through an entire update process, showing
the specified amount of information about any error that occurs. The dialogs
will be shown in front of the specified object.
|
![]() | UpdateInteractive(IWin32Window, ErrorDisplayLevel, ApplyUpdateOptions) |
Uses built-in dialogs to walk the user through an entire update process, showing
the specified amount of information about any error that occurs. The dialogs
will be shown in front of the specified object.
|
![]() | UpdateInteractive(IWin32Window, ErrorDisplayLevel, ApplyUpdateOptions, IDictionary) |
Uses built-in dialogs to walk the user through an entire update process, showing
the specified amount of information about any error that occurs. The dialogs
will be shown in front of the specified object.
|
![]() | ValidateUpdate |
Validates the downloaded update represented by CurrentUpdate, or, if
EnableAutoChaining is , every update in the
update chain.
|
Name | Description | |
---|---|---|
![]() | AddCredentialsToAutoDetectProxy |
Gets or sets a value that specifies whether the controller will add default network credentials to the application's
default web proxy.
|
![]() | AllowElevatedPrivileges | Obsolete.
Gets or sets a value that specifies whether to allow updates to be applied
using a Windows service with administrative privileges. The service must be
installed before it can be used to apply an update.
|
![]() | AllUpdates |
Gets a collection of UpdateInformation objects that represent all
updates found from the last update check, or if no update
information is available.
|
![]() | ApplicationId |
Gets or sets a Guid that is used to uniquely identify the application
that is being updated.
|
![]() | AutoCopyCommandLine |
Gets or sets a value that indicates whether the command line arguments
passed to the application should be automatically passed to it again when
it is restarted after an update.
|
![]() | AutoDetectProxy |
Gets or sets a value that specifies whether the controller will automatically detect proxy settings.
|
![]() | AvailableUpdates |
Gets a collection of UpdateInformation objects that can be applied to
the current Version or if no update information is
available or EnableAutoChaining is .
|
![]() | BypassProxyOnLocal |
Gets or sets a value that specifies whether to bypass using a proxy server for local addresses.
|
![]() | CanRaiseEvents | Gets a value indicating whether the component can raise an event. (Inherited from Component.) |
![]() | ClientAccessKey |
Gets or sets a value that can be used as a secondary client identifier. Client keys can be
used in an AppLife Update Server whitelist. Like the ClientID, this value is passed to the server with each request.
|
![]() | ClientId |
A client identifier generated based on a unique hardware signature and install location
|
![]() | Container | Gets the IContainer that contains the Component. (Inherited from Component.) |
![]() | ControlledRolloutEnabled |
Gets or sets a value that specifies whether controlled rollouts are enabled for
updates received by the controller. When controlled rollouts are enabled, clients
are updated over the amount of time specified in the ControlledRolloutHours property.
|
![]() | ControlledRolloutHours |
Gets or sets the period of time over which clients will be updated when controlled rollouts are enabled.
|
![]() | CurrentUpdate |
Gets or sets information about the currently available update, or if
no update information has been retrieved. If setting this value, the UpdateInformation must be
in the list of updates retured by AllUpdates and EnableAutoChaining must be
.
|
![]() | CustomHttpHeaders |
Gets a collection of custom headers that will be sent with any HTTP request issued by the controller.
|
![]() | CustomHttpHeaderValue | Obsolete.
Gets or sets a String value that, when specified, is added to the http request header collection under the name 'AppLifeHttpHeader'.
The value can be used within a custom http handler on the server to perform server side processing.
|
![]() | CustomIpcData |
Gets or sets a string that is sent with all communications between controllers.
|
![]() | DesignMode | Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.) |
![]() | DisableControllerIpc |
Gets or sets a value that indicates whether the controller will communicate with other
controllers that share the same ApplicationId.
|
![]() | ElevationType |
Gets or sets a value that specifies the level of elevation used to apply
updates. See UpdateElevationType for more information.
|
![]() | EnableAutoChaining |
Gets or sets a value that indicates whether the UpdateController will find,
download and apply all possible updates in sequence, rather than one update at once.
|
![]() | EnableOfflineUpdates |
Gets or sets a value indicating whether the UpdateController will check
for updates using cached data, allowing previously downloaded updates to be applied without network connectivity.
|
![]() | EnableTestUpdates |
Gets or sets a value that indicates whether to allow updates that are flagged as
"test only" to be applied.
|
![]() | Events | Gets the list of event handlers that are attached to this Component. (Inherited from Component.) |
![]() | HostAssemblyLocation |
Gets the Entry Assembly location. To override the host assembly information use the OverrideHostProcessInfo method.
|
![]() | IsBusy |
Gets a value indicating whether an asynchronous operation is currently in progress.
|
![]() | IsFirstRun |
Gets a value indicating that this is the first time an UpdateController has been set to the
current ApplicationId since the last successful update for that ID was applied.
|
![]() | NoUpdateDisplayHtml |
Gets HTML retrieved from the update server that should be shown when no updates are
available, or if no update information has been retrieved.
|
![]() | NoUpdateDisplayText |
Gets text retrieved from the update server that should be shown when no updates are
available, or if no update information has been retrieved.
|
![]() | PreferredDownloadPath |
Gets or sets the directory where downloaded updates will be saved.
If this property is not set, updates will be saved in the current user's
temp directory.
|
![]() | ProxyAddress |
Gets or sets the address of the proxy server the UpdateController will
use when connecting to the update location.
|
![]() | ProxyDomain |
Gets or sets the domain used for authentication on the proxy server.
|
![]() | ProxyPassword |
Gets or sets the password used for authentication on the proxy server.
|
![]() | ProxyUseDefaultCredentials |
Gets or sets a value that specifies whether the UpdateController will use the
credentials of the currently logged on user when accessing the proxy server.
|
![]() | ProxyUserName |
Gets or sets the user name used for authentication on the proxy server.
|
![]() | PublicKeyToken |
Gets or sets the public key token of the strong name key used to create the
updates that will be downloaded and applied by the UpdateController.
If an update cannot be validated using this key, it will not be applied.
|
![]() | Site | (Inherited from Component.) |
![]() ![]() | UpdateLocation |
Gets or sets the network location of the updates for the application. Any
UNC, HTTP, or FTP location can be specified.
|
![]() | UpdateLocationDomain |
Gets or sets a domain user name to use to log in to access the location specified in
UpdateLocation.
|
![]() | UpdateLocationPassword |
Gets or sets a password to use to log in to access the location specified in
UpdateLocation.
|
![]() | UpdateLocationUserName |
Gets or sets a user name to use to log in to access the location specified in
UpdateLocation.
|
![]() | UseDefaultCredentialsOverHttp |
Gets or sets a value that indicates whether to user the current user's credentials
when accessing UpdateLocation, when UpdateLocation is an HTTP URI.
|
![]() | UseHostAssemblyVersion |
Gets or sets a value that specifies whether the controller will use the hosting assembly's
version as the value for Version.
|
![]() | Version |
Gets or sets the current version number of the application used for update purposes.
|
![]() | WebRequestKeepAlive |
Gets or sets a Boolean value that sets the KeepAlive property of a web request for an update.
The default value is true, and should only be set to false if updates are hosted on a server that does not support
the default keep alive behavior.
|
Name | Description | |
---|---|---|
![]() | CheckForUpdateCompleted |
Occurs when an asynchronous update check operation completes.
|
![]() | Disposed | Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.) |
![]() | DownloadUpdateCompleted |
Occurs when an asynchronous update download operation completes.
|
![]() | DownloadUpdateProgressChanged |
Occurs during when an asynchronous update download operation successfully transfers
some or all of the data.
|
![]() | ShutdownRequested | Obsolete.
Occurs when applying an update requires the application to terminate.
|
![]() | UpdateDialogShowing |
Occurs before the built-in update information dialog displays information about
the current update available for download.
|
![]() | UpdateFound |
Occurs when one or more updates have been found.
|
![]() | UpdateStarting |
Occurs when an update is about to be applied.
|
To use an UpdateController, you must first initialize it with information about the update server and the application being updated. The UpdateLocation and ApplicationId properties link the controller to an update server, and the PublicKeyToken property allows it to validate updates. These three properties must be set before the controller can be used to download and apply updates.
In order to determine what updates are available, the controller needs to know the application's version. This information is stored in the Version property. If the UseHostAssemblyVersion property is , Version will automatically be set to the version of the current application.
If the controller may be working through a proxy to download updates, you can use the AutoDetectProxy, ProxyAddress, ProxyDomain, ProxyUseDefaultCredentials, ProxyUserName, ProxyPassword, and BypassProxyOnLocal properties to configure proxy settings.
Once the controller is configured, the easiest way to update your application is to use one of the UpdateInteractive methods. These methods use the controller's built-in dialogs to guide the user through the entire update process. Note that since the user might choose to update the application from these methods, the application might shut down before they return. Handle the UpdateStarting event to perform work needed before the application shuts down.
using System; using System.Windows.Forms; using Kjs.AppLife.Update.Controller; class UpdatableForm : Form { [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new UpdatableForm()); } private UpdateController mController; public UpdatableForm() { Button updateButton = new Button(); updateButton.Text = "Update!"; updateButton.Click += new EventHandler(updateButton_Click); this.Controls.Add(updateButton); this.mController = new UpdateController(); //These settings do not represent a real update server. this.mController.UpdateLocation = "my-update-server/updates"; this.mController.ApplicationId = new Guid("01234567-89AB-CDEF-0123-456789ABCDEF"); this.mController.PublicKeyToken = "<RSAKeyValue><Modulus>25yO48pjp1EWrE/kCAfjtXpX" + "1q/s1iS0stCFqPSJ0IkftbieP80gBitULM2cdR6kMEde/bZ/zwESOCqo2us6aLnKHam5B3o3g94jYf" + "jYWC4KE/fm7qDZx0MkVhmwSfqCZXQdouOmfQVe7Uf48Qg/R3x45alcdDHUAYoNVK8Hn88=</Modulu" + "s><Exponent>AQAB</Exponent></RSAKeyValue>"; } void updateButton_Click(object sender, EventArgs e) { this.mController.UpdateInteractive(this); } }
The controller can also be used to perform each step of the update process separately. To only contact the update server and find what update (if any) is available, use the ShowCheckForUpdateDialog, CheckForUpdateAsync, or CheckForUpdate methods. Each of these methods fills in the CurrentUpdate and NoUpdateDisplayText properties with information from the update server. To download the update represented by CurrentUpdate, use the ShowDownloadUpdateDialog, DownloadUpdateAsync, or DownloadUpdate methods. Once an update has been successfully downloaded, the IsDownloaded property of CurrentUpdate will be set to . To validate a downloaded update, use the ValidateUpdate method. To apply a downloaded update, use the ApplyUpdate method. Like UpdateInteractive, ApplyUpdate can shut down the application.
When checking for an update, the UpdateController will analyze the updates it finds on the update server and choose the highest update that can be applied to Version. You can handle the UpdateFound event to further filter updates based on custom criteria.