oneboxthread.pas

来自「自己用API编写的端口通讯」· PAS 代码 · 共 55 行

PAS
55
字号
unit OneBoxThread;

interface
uses
    Classes,Dialogs,windows,SysUtils;

type
    LightOneBoxThread = Class (TThread)
    protected
       procedure Execute; override;
    end;
implementation

uses
    TestControl;
{ LightOneBoxThread }

procedure LightOneBoxThread.Execute;
var
  i:integer;
  ErrorMessage:string;
begin
  inherited;
//  try
  for i:=0 to Form1.FUnitMaxNumber-1 do
  begin
       if (Self.Terminated=True) then
       begin
            break;
       end;
       if not (Form1.FCabinetControler.LighterStoreUnit(Form1.ComboBoxCabinet.ItemIndex,Form1.ComboBoxBox.ItemIndex,i)) then
       begin
            ErrorMessage:='点亮'+IntToStr(i)+'失败';
            ShowMessage(ErrorMessage);
            break;
       end;
       Sleep(1000);
  end;
  Form1.ButtonQuery.Enabled:=True;
  Form1.ButtonOpenOneBox.Enabled:=True;
  Form1.ButtonLightOneUnit.Enabled:=True;
  Form1.ButtonLightOneBox.Enabled:=True;
  Form1.ButtonQuery.Enabled:=True;
  Form1.ButtonLightAllUnit.Enabled:=True;
  Form1.ButtonStopLightAllUnit.Enabled:=False;
  Form1.ButtonStopLightOneBox.Enabled:=False;
  Form1.ButtonOpenAllBox.Enabled:=True;
//  ShowMessage('点亮单个抽屉的所有单元结束');
//  Self.Terminate;
//  Self.WaitFor;
//  Self.Destroy;
end;

end.
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?