protected void OnCompleted(ReturnCompletedEventArgs e) { if (this.FetchCompleted != null) { this.FetchCompleted(this, e); } }
void FileList_FetchCompleted(object sender, ReturnCompletedEventArgs e) { if (e.Error == null) { PostInfo pi = e.UserState as PostInfo; List<string> files = e.ReturnObject as List<string>; if (pi != null) { pi.FileList = new List<string>(); foreach (string fileUrl in files) { pi.FileList.Add(fileUrl); } } else { this.PostFetchPostsAndFilesComplted( this.projects, new Exception("PostInfo居然为空了!") ); } int currentPostIndex = projects[0].PostList.IndexOf(pi); int nextPostIndex = currentPostIndex + 1; //发送进度时间 this.PostFetchFilesInPostProgressChanged( currentPostIndex + 1, projects[0].PostList.Count ); //是否完成 if (nextPostIndex < projects[0].PostList.Count) { this.flf.Url = projects[0].PostList[nextPostIndex].Url; this.flf.FetchListAnsy(projects[0].PostList[nextPostIndex]); } else { this.PostFetchPostsAndFilesComplted(this.projects, null); } } else { this.PostFetchPostsAndFilesComplted(this.projects, e.Error); } }