ApplicationDeployment.TimeOfLastUpdateCheck Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the date and the time ClickOnce last checked for an application update.
public:
property DateTime TimeOfLastUpdateCheck { DateTime get(); };
public DateTime TimeOfLastUpdateCheck { get; }
member this.TimeOfLastUpdateCheck : DateTime
Public ReadOnly Property TimeOfLastUpdateCheck As DateTime
Property Value
The DateTime of the last update check.
Examples
The following code example checks whether a ClickOnce application has been checked for available updates in the past three days.
public:
bool CheckForUpdateDue()
{
bool isUpdateDue = false;
if (ApplicationDeployment::IsNetworkDeployed)
{
ApplicationDeployment^ dueAppDeployment =
ApplicationDeployment::CurrentDeployment;
TimeSpan^ updateInterval =
DateTime::Now - dueAppDeployment->TimeOfLastUpdateCheck;
if (updateInterval->Days >= 3)
{
isUpdateDue = true;
}
}
return (isUpdateDue);
}
private Boolean CheckForUpdateDue()
{
Boolean isUpdateDue = false;
if (ApplicationDeployment.IsNetworkDeployed)
{
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
TimeSpan updateInterval = DateTime.Now - ad.TimeOfLastUpdateCheck;
if (updateInterval.Days > 3)
{
isUpdateDue = true;
}
}
return (isUpdateDue);
}
Private Function CheckForUpdateDue() As Boolean
Dim isUpdateDue As Boolean = False
If (ApplicationDeployment.IsNetworkDeployed) Then
Dim AD As ApplicationDeployment = ApplicationDeployment.CurrentDeployment
Dim updateInterval As TimeSpan = DateTime.Now - AD.TimeOfLastUpdateCheck
If (updateInterval.Days > 3) Then
isUpdateDue = True
End If
End If
CheckForUpdateDue = isUpdateDue
End Function
Remarks
A ClickOnce application can be configured for subscription updates. In this scenario, ClickOnce polls an application's deployment location automatically at intervals defined in the deployment manifest, and determines whether there is an update available. TimeOfLastUpdateCheck returns the time of the last update check regardless of whether it was initiated by a subscription or by an explicit check using the CheckForUpdate, CheckForUpdateAsync, CheckForDetailedUpdate, Update, or UpdateAsync method.
If no update check has been performed since the application was installed, TimeOfLastUpdateCheck returns the installation time.