Raising an event using C#
Posted on 2005-04-14
I have this subroutine that checks a manifest file if there are updates on my server. I do not want it to give the user an option whether to download or not. I want it to download automatically and notify the user after the download possibly by raising an event. I do not want a message box. How can I achieve this with raising an event. Here is my code below.
I also want to raise an event if there are no updates and not a message box.
private static void UpdateApplication()
ApplicationUpdaterManager updaterManager = ApplicationUpdaterManager.GetUpdater( config.ApplicationID );
Manifest manifests = updaterManager.CheckForUpdates( config.ManifestUri );
if(manifests.Length > 0)
if (DialogResult.Yes == MessageBox.Show(null,"Updates available do you want to apply?","SimpleAppStart",MessageBoxButtons.YesNo,MessageBoxIcon.Question) )
foreach(Manifest manifest in manifests)
manifest.Application.Location = Path.GetDirectoryName(config.ExecutablePath);
manifest.Apply = true;
updaterManager.Download( manifests, TimeSpan.MaxValue );
updaterManager.Activate( manifests );
MessageBox.Show(null,"No updates available","SimpleAppStart",MessageBoxButtons.OK,MessageBoxIcon.Information);