Application Update Customization using Custom Data

When publishing updates for applications, it is often helpful to implement rules that can be applied on an update-by-update basis. With AppLife Update, the custom data field provides this opportunity.

clip_image001

With each update, you can specify a custom data string to go with the update. This value is then available to your application after an update check has been performed. Your application can interrogate the value and control additional logic based on the information. As an example, when creating updates for AppLife Update, we use this field to know whether or not the update requires Visual Studio to be closed. If it does, we add a RequiresVSClosed property to the custom data field.

 

Accessing the Custom Data in Your Application

After an update check, the update controller has a CurrentUpdate property that holds an UpdateInformation object. This object has a CustomData property that holds, you guessed it, the Custom Data string that you specify when publishing the update.

Code Snippet

if(updateController1.CheckForUpdate()) {

string customData =updateController1.CurrentUpdate.CustomData;

}

 

Changing Custom Data after Publication

Custom Data can be modified after an update has been published without having to re-build the update package itself. To modify custom data, you can Manage Published Updates…

From the Manage Published Updates dialog the Custom Data string can be modified and then published.

clip_image002

A Class to Parse Name/Value Pairs

A common approach to be able to provide multiple pieces of information through the custom data string is to use a name/value pair syntax, and then extract this information within your application code. To help with this, here is a class that will parse a custom data field using a name=value; syntax.

AppUpdateCustomData.cs and AppUpdateCustomData.vb

Using this class, you can easily extract and use multi-value custom data strings in your applications.

clip_image003

Using the AppUpdateCustomData class:

Code Snippet

1:  if(updateController1.CheckForUpdate()) {  
2:    Kjs.AppLife.Update.AppUpdateCustomData customData = newKjs.AppLife.Update.AppUpdateCustomData(updateController1.CurrentUpdate.CustomData);  
3:   string myValue1;  
4:   string myValue2;  
5:   if(customData.DataTable.ContainsKey("MyName1")) {  
6:  myValue1 = customData.DataTable["MyName1"];  
7:   }  
8:   if(customData.DataTable.ContainsKey("MyName2")) {  
9:   myValue2 = customData.DataTable["MyName2"];  
10:   }  
11:  }  

In conclusion, the Custom Data field provides the means for update publishers to assign information to individual update packages that applications can use to control application update behavior.

Scroll to Top