So in der Art (schnell hingeschrieben, ungetestet):
Delphi-Quellcode:
TDialogService.MessageDialog(Frage, TMsgDlgType.mtConfirmation, mbYesNo, 0,
procedure(const AResult: TModalResult)
begin
if AResult = mrYes then begin
case Command of
0:
begin
ShowMessage(rsShutdown);
fDevice.SendShutDown(Command);
fDevice.Connected := False;
Halt(0);
end;
1:
begin
ShowMessage(rsReboot);
fDevice.SendShutDown(Command);
fDevice.Connected := False;
repeat
Sleep(10000);
until fDevice.ConnectionTest;
end;
end;
end;
end
);