public ProgressDialog(AutoUpdate autoUpdate, PendingUpdate update) { InitializeComponent(); _autoUpdate = autoUpdate; _update = update; Loaded += delegate { Action <double> downloadProgress = (value) => { Dispatcher.BeginInvoke(new Action(() => { DownloadProgressBar.Value = value; })); }; Action installerStarted = () => { App.Current.Shutdown(); }; _autoUpdate.InstallPendingUpdate(_update as PendingUpdate, downloadProgress, installerStarted); }; }
public void Should_run_installer_application() { _autoUpdate.UpdateSettings.UpdatePath = new Uri(_webServer.Uri, "update-file-1.1.0.0.xml"); _autoUpdate.UpdateSettings.CurrentVersion = new Version("1.0.0.0"); _autoUpdate.InvalidSignatureDetected += delegate { Assert.Fail("Invalid signature detected"); }; using (var socketListener = new SocketListener("Hello from: AutoUpdate\r\n")) { var acceptResult = socketListener.Listen(); var updatePending = _autoUpdate.IsUpdatePending(); _autoUpdate.InstallPendingUpdate(_autoUpdate.PendingUpdates[0]); Assert.That(updatePending, Is.True); Assert.That(acceptResult.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(10)), Is.True, "Timed out waiting for installer to call back"); } }