C# /CSharp

C# Application that checks for new versions

Normally when I create some application and know that users will use it a lot, there is a underlying need of making sure the end user is using the latest version.

To show one way of making this possible is using xml files at the server side, describing the changes and where to fetch new versions.
So in other means, the code explain it self….

OrdinaryApp.zip Containing the source with example.

[sourcecode language=”csharp”]
public static string VERSION = “0.5”;

public Form1()
{
InitializeComponent();

// Register the Event to trigger a method when Updates are found.
eventCatcher();
}

private void eventCatcher()
{

CheckUpdate.NewVersionToDownloadEvent += new CheckUpdate.NewVersionToDownload(newVersion);
}

///
/// Get the new version available
///
///
private void newVersion(object newVersion)
{
NewVersion nV = (NewVersion)newVersion;
DialogResult dr =
MessageBox.Show(nV.MessageFromXml, “New version:” + nV.Version + ” is available.”,
MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1,
MessageBoxOptions.ServiceNotification);
if (dr == DialogResult.Yes)
{
Process.Start(nV.Url + nV.Filename);
}
}

///
/// The metod triggerd when the application has loaded.
///
///
///
private void onLoad(object sender, EventArgs e)
{
// This could be when started, or button or other thing.
new CheckUpdate(false, VERSION, “http://www.lightsoft.se/_software_updates/OrdinaryApp.xml”);
}
[/sourcecode]

Then the XML file describing the versions could look like this:
[sourcecode language=”xml”]



Added autocheck if an update is possible
Change the thread management for the text to be update. New rules in .Net 3.0

Faster calculations

Main application done


Beta 1

[/sourcecode]

Leave a Reply

Your email address will not be published. Required fields are marked *