private void ProcessWriteFileEx(Exception ex, AppInstallItem item) { item.SetLastEx(ex); this.UpdateProgress(0, item); if (ex is PathTooLongException) { this.UpdateState(InstallState.InstallFail_PathTooLongException, item); } else if (ex is IOException) { this.UpdateState(InstallState.InstallFail_FileInUse, item); } else if (ex is UnauthorizedAccessException) { this.UpdateState(InstallState.InstallFail_UnauthorizedAccess, item); } else if (ex is SecurityException) { this.UpdateState(InstallState.InstallFail_RequirePermission, item); } else { this.UpdateState(InstallState.InstallFail, item); } }
private void InitHttpHelper(HttpHelper helper, AppInstallItem appInstallItem) { helper.RetryBroken = true; helper.RetryTimes = 10; helper.AddHeader("SoonLearningPlatformKey", "{1FB07182-8794-47F1-90DB-7B3698AE1E61}"); helper.DownloadProgressChanged += ((sender, e) => { if (this.dispatcher != null) { this.UpdateProgress(e.ProgressPercentage, appInstallItem); } }); helper.DownloadFileCompleted += ((sender, e) => { if (e.Cancelled) { this.UpdateState(InstallState.UserCancelled, appInstallItem); this.InvokeInstallCompletedEvent(appInstallItem, e.Error); } else if (e.Error != null) { appInstallItem.SetLastEx(e.Error); this.UpdateState(InstallState.DownloadFail, appInstallItem); // this.installingAppCollection.Remove(appInstallItem); this.InvokeInstallCompletedEvent(appInstallItem, e.Error); } else { this.Install(appInstallItem); } this.runningItem = null; this.Next(); }); }