private void AllFilesFinished(object sender, FileCountEventArgs e) { if (Event_AllFilesFinished != null) { FileCountEventArgs ev = new FileCountEventArgs(); Event_AllFilesFinished(this, ev); } }
//属性更改事件 private void item_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "State") { UserFile file = (UserFile)sender; if (file.State == Constants.FileStates.Finished) { _currentUpload--; TotalUploadedFiles++; UploadFiles(); if (SingleFileUploadFinished != null) { SingleFileUploadFinished(this, null); } if (_currentUpload == 0) { if (AllFilesFinished != null) { FileCountEventArgs ev = new FileCountEventArgs(); ev.Counted = TotalUploadedFiles; AllFilesFinished(this, ev); } } } else if (file.State == Constants.FileStates.Deleteing) //逻辑删除 { if (!_isDeleting) { file.State = Constants.FileStates.Deleted; } } else if (file.State == Constants.FileStates.Deleted) { file.Del_FileAndID(); this.Remove(file); file = null; } else if (file.State == Constants.FileStates.DeleteFinished) { _currentUpload--; TotalUploadedFiles++; if (_currentUpload == 0) { if (AllFilesFinished != null) { FileCountEventArgs ev = new FileCountEventArgs(); ev.Counted = TotalUploadedFiles; AllFilesFinished(this, ev); } } } else if (file.State == Constants.FileStates.Remove) { this.Remove(file); file = null; } else if (file.State == Constants.FileStates.Error) { _currentUpload--; UploadFiles(); if (ErrorOccurred != null) { ErrorOccurred(this, null); } } if (StateChanged != null) { StateChanged(this, null); } // AreAllFilesFinished(); } else if (e.PropertyName == "BytesUploaded") { RecountTotal(); } if (Event_showPnl != null) { Event_showPnl(this, null); } }