main
 1using gorilla.commons.utility;
 2using Gorilla.Commons.Utility;
 3using momoney.service.infrastructure.updating;
 4
 5namespace MoMoney.Service.Infrastructure.Updating
 6{
 7    public class DownloadTheLatestVersion : IDownloadTheLatestVersion
 8    {
 9        readonly IDeployment deployment;
10
11        public DownloadTheLatestVersion(IDeployment deployment)
12        {
13            this.deployment = deployment;
14        }
15
16        public void run(Callback<Percent> callback)
17        {
18            deployment.UpdateProgressChanged += (o, e) => callback.run(new Percent(e.BytesCompleted, e.BytesTotal));
19            deployment.UpdateCompleted += (sender, args) => callback.run(100);
20            deployment.UpdateAsync();
21        }
22    }
23}