/// <summary> /// This method shows the update ui and allows to perform the /// update process /// </summary> /// <param name="currentItem">the item to show the UI for</param> public void ShowUpdateNeededUI(NetSparkleAppCastItem currentItem) { if (this.UserWindow == null) { // create the form this.UserWindow = new NetSparkleForm(currentItem, ApplicationIcon, ApplicationWindowIcon); } this.UserWindow.CurrentItem = currentItem; if (this.HideReleaseNotes) { this.UserWindow.HideReleaseNotes(); } // clear if already set. this.UserWindow.UserResponded -= new EventHandler(OnUserWindowUserResponded); this.UserWindow.UserResponded += new EventHandler(OnUserWindowUserResponded); this.UserWindow.Show(); }
/// <summary> /// Unregisters events so that we don't have multiple items updating /// </summary> private void UnregisterEvents() { ServicePointManager.ServerCertificateValidationCallback -= RemoteCertificateValidation; _worker.DoWork -= new DoWorkEventHandler(OnWorkerDoWork); _worker.ProgressChanged -= new ProgressChangedEventHandler(OnWorkerProgressChanged); _worker = null; if (_webDownloadClient != null) { if (this.ProgressWindow != null) { _webDownloadClient.DownloadProgressChanged -= new DownloadProgressChangedEventHandler(this.ProgressWindow.OnClientDownloadProgressChanged); } _webDownloadClient.DownloadFileCompleted -= new AsyncCompletedEventHandler(OnWebDownloadClientDownloadFileCompleted); _webDownloadClient = null; } if (this.UserWindow != null) { this.UserWindow.UserResponded -= new EventHandler(OnUserWindowUserResponded); this.UserWindow = null; } if (this.ProgressWindow != null) { this.ProgressWindow.InstallAndRelaunch -= new EventHandler(OnProgressWindowInstallAndRelaunch); this.ProgressWindow = null; } }