更多并行模式详解
1. 创建管道
用户界面有一个按钮,可用于启动和停止并行操作。其 OnClick 事件代码如下:
procedure TfrmPipeline.btnStartClick(Sender: TObject);
begin
if btnStart.Tag = 0 then begin
ListBox1.Items.Add(inpStartFolder.Text);
CreatePipeline;
btnStart.Caption := 'Stop';
btnStart.Tag := 1;
TimerUpdateProcessing.Enabled := true;
end
else
if assigned(FPipeline) then
FPipeline.Cancel;
end;
当 btnStart.Tag 为 0 时,会调用 CreatePipeline 方法启动流程,同时更新按钮文本和标签,并启用定时器;否则,若管道对象存在,则调用其 Cancel 方法停止流程。
CreatePipeline 方法用于创建、配置和启动管道:
procedure TfrmPipeline.CreatePipe
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



