unit UMain;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
FMX.Controls.Presentation, System.SyncObjs;
type
TForm3 = class(TForm)
Label1: TLabel;
Button1: TButton;
Button2: TButton;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private-Deklarationen }
FEvent: TEvent;
public
{ Public-Deklarationen }
end;
var
Form3: TForm3;
implementation
{$R *.fmx}
procedure TForm3.Button1Click(Sender: TObject);
begin
// if FEvent.WaitFor(0) <> TWaitresult.wrSignaled then
FEvent.SetEvent;
end;
procedure TForm3.Button2Click(Sender: TObject);
begin
//if FEvent.WaitFor(0) = TWaitresult.wrSignaled then
FEvent.ResetEvent;
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
FEvent := TEvent.Create(nil, true, false, '');
end;
procedure TForm3.FormDestroy(Sender: TObject);
begin
FEvent.Free;
end;
procedure TForm3.Timer1Timer(Sender: TObject);
begin
case FEvent.WaitFor(0) of
wrSignaled:
Label1.Text := 'Signaled';
wrTimeout:
Label1.Text := 'Timeout';
wrAbandoned:
Label1.Text := 'Abandoned';
wrError:
Label1.Text := 'Error';
wrIOCompletion:
Label1.Text := 'IOCompletion';
end;
end;