private void timerConvert_Tick(object sender, EventArgs e) { if (mConverter == null || mThreadCount <= 0) { return; } int i = 0; for (i = 0; i < mConverter.TasksCount; i++) { ICProgressInfo progressInfo = null; progressInfo = mConverter.get_ProgressInfo(i); OnProgressInfo(progressInfo); ICTerminateInfo terminateInfo = null; terminateInfo = mConverter.get_TerminateInfo(i); OnTerminateInfo(terminateInfo); ICCustomHookInfo customHookInfo = null; customHookInfo = mConverter.get_CustomHookInfo(i); OnCustomHookInfo(customHookInfo); } }
private void OnTerminateInfo(ICTerminateInfo terminateInfo) { int taskIndex = terminateInfo.TaskIndex; bool bFinished = terminateInfo.Finished; bool bException = terminateInfo.Exception; string exceptionMsg = terminateInfo.ExceptionMsg; if (taskIndex < 0) { return; } if (bFinished) { listViewTask.Items[taskIndex].SubItems[COLUMN_INDEX_CONVERT_PROGRESS].Text = "100%"; } else if (bException) { richTextBoxLog.Text += "\r\n"; richTextBoxLog.Text += "***File load error: " + exceptionMsg; richTextBoxLog.Text += "\r\n"; richTextBoxLog.Focus(); richTextBoxLog.Select(richTextBoxLog.TextLength, 0); richTextBoxLog.ScrollToCaret(); } int completedTask = 0; for (int i = 0; i < listViewTask.Items.Count; i++) { if (listViewTask.Items[i].SubItems[COLUMN_INDEX_CONVERT_PROGRESS].Text == "100%") { completedTask++; } } if (completedTask >= listViewTask.Items.Count) { OnConvertCompleted(); } }