SimulatorFans/Client/source/ESCCalibrationFrm.pas

79 lines
1.4 KiB
ObjectPascal
Raw Normal View History

unit ESCCalibrationFrm;
interface
uses
System.Classes,
Vcl.Controls,
Vcl.Forms,
Vcl.StdCtrls,
Simulator.Registry;
type
TESCCalibrationForm = class(TForm)
CloseButton: TButton;
CalibrationGroupBox: TGroupBox;
HelpLabel1: TLabel;
HelpLabel2: TLabel;
FullButton: TButton;
OffButton: TButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FullButtonClick(Sender: TObject);
procedure OffButtonClick(Sender: TObject);
private
FFans: ISimulatorFans;
FFull: Boolean;
protected
property Fans: ISimulatorFans read FFans;
public
class procedure Execute(AFans: ISimulatorFans);
end;
implementation
{$R *.dfm}
{ TESCCalibrationForm }
class procedure TESCCalibrationForm.Execute(AFans: ISimulatorFans);
begin
with Self.Create(nil) do
try
FFans := AFans;
ShowModal;
finally
Free;
end;
end;
procedure TESCCalibrationForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if FFull then
Fans.SetAll(0);
end;
procedure TESCCalibrationForm.FullButtonClick(Sender: TObject);
begin
FullButton.Enabled := False;
OffButton.Enabled := True;
Fans.SetFull;
FFull := True;
end;
procedure TESCCalibrationForm.OffButtonClick(Sender: TObject);
begin
FullButton.Enabled := True;
OffButton.Enabled := False;
Fans.SetAll(0);
FFull := False;
end;
end.