main
  1using System;
  2using System.ComponentModel;
  3using System.Deployment.Application;
  4using MoMoney.Service.Infrastructure.Updating;
  5
  6namespace momoney.service.infrastructure.updating
  7{
  8    public class CurrentDeployment : IDeployment
  9    {
 10        readonly ApplicationDeployment deployment;
 11
 12        public CurrentDeployment()
 13        {
 14            deployment = ApplicationDeployment.CurrentDeployment;
 15        }
 16
 17        public UpdateCheckInfo CheckForDetailedUpdate()
 18        {
 19            return deployment.CheckForDetailedUpdate();
 20        }
 21
 22        public UpdateCheckInfo CheckForDetailedUpdate(bool persistUpdateCheckResult)
 23        {
 24            return deployment.CheckForDetailedUpdate(persistUpdateCheckResult);
 25        }
 26
 27        public bool CheckForUpdate()
 28        {
 29            return deployment.CheckForUpdate();
 30        }
 31
 32        public bool CheckForUpdate(bool persistUpdateCheckResult)
 33        {
 34            return deployment.CheckForUpdate(persistUpdateCheckResult);
 35        }
 36
 37        public void CheckForUpdateAsync()
 38        {
 39            deployment.CheckForUpdateAsync();
 40        }
 41
 42        public void CheckForUpdateAsyncCancel()
 43        {
 44            deployment.CheckForUpdateAsyncCancel();
 45        }
 46
 47        public bool Update()
 48        {
 49            return deployment.Update();
 50        }
 51
 52        public void UpdateAsync()
 53        {
 54            deployment.UpdateAsync();
 55        }
 56
 57        public void UpdateAsyncCancel()
 58        {
 59            deployment.UpdateAsyncCancel();
 60        }
 61
 62        public void DownloadFileGroup(string groupName)
 63        {
 64            deployment.DownloadFileGroup(groupName);
 65        }
 66
 67        public void DownloadFileGroupAsync(string groupName)
 68        {
 69            deployment.DownloadFileGroupAsync(groupName);
 70        }
 71
 72        public void DownloadFileGroupAsync(string groupName, object userState)
 73        {
 74            deployment.DownloadFileGroupAsync(groupName, userState);
 75        }
 76
 77        public bool IsFileGroupDownloaded(string groupName)
 78        {
 79            return deployment.IsFileGroupDownloaded(groupName);
 80        }
 81
 82        public void DownloadFileGroupAsyncCancel(string groupName)
 83        {
 84            deployment.DownloadFileGroupAsyncCancel(groupName);
 85        }
 86
 87        public Version CurrentVersion
 88        {
 89            get { return deployment.CurrentVersion; }
 90        }
 91
 92        public Version UpdatedVersion
 93        {
 94            get { return deployment.UpdatedVersion; }
 95        }
 96
 97        public string UpdatedApplicationFullName
 98        {
 99            get { return deployment.UpdatedApplicationFullName; }
100        }
101
102        public DateTime TimeOfLastUpdateCheck
103        {
104            get { return deployment.TimeOfLastUpdateCheck; }
105        }
106
107        public Uri UpdateLocation
108        {
109            get { return deployment.UpdateLocation; }
110        }
111
112        public Uri ActivationUri
113        {
114            get { return deployment.ActivationUri; }
115        }
116
117        public string DataDirectory
118        {
119            get { return deployment.DataDirectory; }
120        }
121
122        public bool IsFirstRun
123        {
124            get { return deployment.IsFirstRun; }
125        }
126
127        public event DeploymentProgressChangedEventHandler CheckForUpdateProgressChanged
128        {
129            add { deployment.CheckForUpdateProgressChanged += value; }
130            remove { deployment.CheckForUpdateProgressChanged -= value; }
131        }
132
133        public event CheckForUpdateCompletedEventHandler CheckForUpdateCompleted
134        {
135            add { deployment.CheckForUpdateCompleted += value; }
136            remove { deployment.CheckForUpdateCompleted -= value; }
137        }
138
139        public event DeploymentProgressChangedEventHandler UpdateProgressChanged
140        {
141            add { deployment.UpdateProgressChanged += value; }
142            remove { deployment.UpdateProgressChanged -= value; }
143        }
144
145        public event AsyncCompletedEventHandler UpdateCompleted
146        {
147            add { deployment.UpdateCompleted += value; }
148            remove { deployment.UpdateCompleted -= value; }
149        }
150
151        public event DeploymentProgressChangedEventHandler DownloadFileGroupProgressChanged
152        {
153            add { deployment.DownloadFileGroupProgressChanged += value; }
154            remove { deployment.DownloadFileGroupProgressChanged -= value; }
155        }
156
157        public event DownloadFileGroupCompletedEventHandler DownloadFileGroupCompleted
158        {
159            add { deployment.DownloadFileGroupCompleted += value; }
160            remove { deployment.DownloadFileGroupCompleted -= value; }
161        }
162    }
163}