예제 #1
0
        private void InitProgressEvent()
        {
            DownloadProgressChangedEx += new DownloadProgressChangedEventHandlerEx((sender, e) =>
            {
                try
                {
                    ReceivedBytes = e.BytesReceived;
                    TotalBytes    = e.TotalBytesToReceive;

                    var eventArgs = new MutiDownloadProgressChangedEventArgs(_version,
                                                                             ProgressType.Donwload,
                                                                             string.Empty,
                                                                             e.BytesReceived / DEFAULT_DELTA,
                                                                             e.TotalBytesToReceive / DEFAULT_DELTA,
                                                                             e.ProgressPercentage,
                                                                             e.UserState);

                    _manager.OnMutiDownloadProgressChanged(this, eventArgs);
                }
                catch (Exception exception)
                {
                    _manager.OnMutiDownloadError(this, new MutiDownloadErrorEventArgs(exception, _version));
                }
            });
        }
예제 #2
0
 private void OnMutiDownloadProgressChanged(object sender, MutiDownloadProgressChangedEventArgs e)
 {
     //e.TotalBytesToReceive 当前更新包需要下载的总大小
     //e.ProgressValue 当前进度值
     //e.ProgressPercentage 当前进度的百分比
     //e.Version 当前下载的版本信息
     //e.Type 当前正在执行的操作  1.ProgressType.Check 检查版本信息中 2.ProgressType.Donwload 正在下载当前版本 3. ProgressType.Updatefile 更新当前版本 4. ProgressType.Done更新完成 5.ProgressType.Fail 更新失败
     //e.BytesReceived 已下载大小
 }
예제 #3
0
        public void OnProgressEventAction(object handle, ProgressType type, string message)
        {
            if (ProgressEventAction == null)
            {
                return;
            }
            var eventArgs =
                new MutiDownloadProgressChangedEventArgs(new UpdateVersion(Version.MD5, Version.PubTime, Version.Version, null, Version.Name), type, message);

            ProgressEventAction(handle, eventArgs);
        }