unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,UAlarmclock, StdCtrls, jpeg, ExtCtrls, MPlayer;
type
TForm1 =
class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Image1: TImage;
Label4: TLabel;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Shape5: TShape;
Shape6: TShape;
Shape7: TShape;
Shape8: TShape;
Shape9: TShape;
Shape10: TShape;
Shape11: TShape;
Shape12: TShape;
Shape13: TShape;
Shape14: TShape;
Shape15: TShape;
Shape16: TShape;
Shape17: TShape;
Label5: TLabel;
MediaPlayer1: TMediaPlayer;
Shape18: TShape;
Edit1: TEdit;
Label6: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Edit2: TEdit;
Edit3: TEdit;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
alpha:TAlarmclock;
procedure write;
public
end;
var
Form1: TForm1;
x:Integer;
HourWeck, MinWeck: Integer;
dataPfad:
String;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
//****JJ****\\
begin // . \
if Button1.Caption='
Schließen'
then // .
begin // .
label6.Visible:=false;
// .
edit1.Visible:=false;
// .
edit2.Visible:=false;
// .
edit3.Visible:=false;
// .
label7.Visible:=false;
// .
label8.Visible:=false;
// .
Button1.Caption:='
Stellen';
// .
HourWeck:=strtoint(edit2.Text);
// .
alpha.SetAlarmTime(HourWeck,MinWeck);
// .
end // .
else if Button1.Caption='
Stellen'
then begin // .
label6.Visible:=true;
// .
edit1.Visible:=true;
// .
edit2.Visible:=true;
// .
edit3.Visible:=true;
// .
label7.Visible:=true;
// .
label8.Visible:=true;
// .
Button1.Caption:='
Schließen';
// .
MinWeck:=strtoint(edit3.Text);
// . \
end //****JJ****\\
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
label4.Caption := FormatDateTime('
dd.mm.yyyy', now);
alpha:=TAlarmclock.create;
write;
alpha.Onchange:=
Write;
alpha.Start;
alpha.setsec(StrToInt(formatdatetime('
ss',time)));
alpha.setmin(StrToInt(formatdatetime('
nn',time)));
alpha.sethour(StrToInt(formatdatetime('
hh',time)));
x:= 86400-(alpha.gethour * 3600) - (alpha.getmin*60) - (alpha.getsec);
label5.caption:=IntToStr(x);
//****JJ****\\
{}HourWeck := strtoint(Edit2.Text);
{}MinWeck := strtoint(Edit3.Text);
{}alpha.SetAlarmTime(HourWeck,MinWeck);
//****JJ****\\
end;
procedure TForm1.
write;
var i,j,z:Integer;
begin
label1.Caption:=IntToStr(alpha.getsec);
label2.Caption:=IntToStr(alpha.getmin);
label3.caption:=IntToStr(alpha.gethour);
j:=alpha.getsec;
if (j
mod 2) = 1
then shape1.Brush.Color:=clblack
else shape1.brush.Color:=clsilver;
j:=(j
div 2);
if (j
mod 2) = 1
then shape2.Brush.Color:=clblack
else shape2.brush.Color:=clsilver;
j:=(j
div 2);
if (j
mod 2) = 1
then shape3.Brush.Color:=clblack
else shape3.brush.Color:=clsilver;
j:=(j
div 2);
if (j
mod 2) = 1
then shape4.Brush.Color:=clblack
else shape4.brush.Color:=clsilver;
j:=(j
div 2);
if (j
mod 2) = 1
then shape5.Brush.Color:=clblack
else shape5.brush.Color:=clsilver;
j:=(j
div 2);
if (j
mod 2) = 1
then shape6.Brush.Color:=clblack
else shape6.brush.Color:=clsilver;
i:=alpha.getmin;
if (i
mod 2) = 1
then shape7.Brush.Color:=clblack
else shape7.brush.Color:=clsilver;
i:=(i
div 2);
if (i
mod 2) = 1
then shape8.Brush.Color:=clblack
else shape8.brush.Color:=clsilver;
i:=(i
div 2);
if (i
mod 2) = 1
then shape9.Brush.Color:=clblack
else shape9.brush.Color:=clsilver;
i:=(i
div 2);
if (i
mod 2) = 1
then shape10.Brush.Color:=clblack
else shape10.brush.Color:=clsilver;
i:=(i
div 2);
if (i
mod 2) = 1
then shape11.Brush.Color:=clblack
else shape11.brush.Color:=clsilver;
i:=(i
div 2);
if (i
mod 2) = 1
then shape12.Brush.Color:=clblack
else shape12.brush.Color:=clsilver;
z:=alpha.gethour;
if (z
mod 2) = 1
then shape13.Brush.Color:=clblack
else shape13.brush.Color:=clsilver;
z:=(z
div 2);
if (z
mod 2) = 1
then shape14.Brush.Color:=clblack
else shape14.brush.Color:=clsilver;
z:=(z
div 2);
if (z
mod 2) = 1
then shape15.Brush.Color:=clblack
else shape15.brush.Color:=clsilver;
z:=(z
div 2);
if (z
mod 2) = 1
then shape16.Brush.Color:=clblack
else shape16.brush.Color:=clsilver;
z:=(z
div 2);
if (z
mod 2) = 1
then shape17.Brush.Color:=clblack
else shape17.brush.Color:=clsilver;
if x>0
then x:=x-1
else x:=86400;
label5.caption:=IntToStr(x);
if shape18.Visible=true
then shape18.visible:=false
else shape18.Visible:=true;
//****JJ****\\
{}if alpha.AlarmOn = true
then
{} begin
{} dataPfad := Edit1.Text;
{} MediaPlayer1.FileName := dataPfad;
{} MediaPlayer1.Open;
{} MediaPlayer1.Play;
{} end;
//****JJ****\\
end;
procedure TForm1.Button2MouseDown(Sender: TObject; Button: TMouseButton;
//****JJ****\\
Shift: TShiftState; X, Y: Integer);
// . \
begin // .
Label9.Visible:=true;
// .
Label10.Visible:=true;
// .
Label11.Visible:=true;
// .
Label12.Visible:=true;
// .
Label10.Caption:=inttostr(HourWeck);
// .
Label11.Caption:=inttostr(MinWeck);
// .
end;
// .
// .
procedure TForm1.Button2MouseUp(Sender: TObject; Button: TMouseButton;
// .
Shift: TShiftState; X, Y: Integer);
// .
begin // .
Label9.Visible:=false;
// .
Label10.Visible:=false;
// .
Label11.Visible:=false;
// .
Label12.Visible:=false;
// . \
end;
//****JJ****\\
end.