//************************************************************** // AppUpdater Constructor //************************************************************** public AppDownloader(AppUpdater appMan) { AppMan = appMan; Log = new UpdateLog(); UpdateEventArgs = new UpdateCompleteEventArgs(); ConnStrengthEventArgs = new ConnectionStrengthChangeEventArgs(); }
//************************************************************** // OnDownloaderComplete() //************************************************************** private void OnDownloaderComplete(object sender, UpdateCompleteEventArgs args) { if (OnUpdateComplete != null) { foreach (UpdateCompleteEventHandler UC in OnUpdateComplete.GetInvocationList()) { EventControl.BeginInvoke(UC, new object[] { sender, args }); } } EventControl.BeginInvoke(new UpdateCompleteEventHandler(UpdateCompleteOps), new object[] { sender, args }); }
//************************************************************** // UpdateCompleteOps() //************************************************************** private void UpdateCompleteOps(object sender, UpdateCompleteEventArgs args) { if (ShowDefaultUI) { if (args.UpdateSucceeded) { UpdateForm F = new UpdateForm(); if (F.ShowDialog() == DialogResult.Yes) { RestartApp(); } } else { string ErrorMessage; ErrorMessage = "The auto-update of this application failed with the following error message: \r\n\r\n" + args.ErrorMessage + "\r\n\r\n" + "To correct this problem, try rebooting the computer & re-launching this application."; MessageBox.Show(ErrorMessage, "Application Update Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
//************************************************************** // UpdateCompleteOps() //************************************************************** private void UpdateCompleteOps(object sender, UpdateCompleteEventArgs args) { if (ShowDefaultUI) { if (args.UpdateSucceeded) { UpdateForm F = new UpdateForm(); if (F.ShowDialog()==DialogResult.Yes) RestartApp(); } else { string ErrorMessage; ErrorMessage = "The auto-update of this application failed with the following error message: \r\n\r\n" + args.ErrorMessage + "\r\n\r\n" + "To correct this problem, try connecting to a high-speed network or re-launching this application."; MessageBox.Show(ErrorMessage,"Application Update Failed",MessageBoxButtons.OK,MessageBoxIcon.Warning); } } }
//************************************************************** // OnDownloaderComplete() //************************************************************** private void OnDownloaderComplete(object sender, UpdateCompleteEventArgs args) { if (OnUpdateComplete != null) { foreach ( UpdateCompleteEventHandler UC in OnUpdateComplete.GetInvocationList()) { EventControl.BeginInvoke(UC,new object[] {sender, args}); } } EventControl.BeginInvoke(new UpdateCompleteEventHandler(UpdateCompleteOps),new object[] {sender, args}); }
//************************************************************** // AppUpdater Constructor //************************************************************** public AppDownloader(AppUpdater appMan) { AppMan = appMan; Log = new UpdateLog(); UpdateEventArgs = new UpdateCompleteEventArgs(); }