unit artikelloeschen;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, IdComponent, IdTCPConnection, IdTCPClient,
IdFTP, IdBaseComponent, IdIntercept, IdLogBase, IdLogDebug, ExtCtrls;
type
TForm1 =
class(TForm)
IdLogDebug1: TIdLogDebug;
IdFTP1: TIdFTP;
DebugListBox: TListBox;
StatusBar1: TStatusBar;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Button3: TButton;
Button4: TButton;
Label1: TLabel;
Timer1: TTimer;
Timer2: TTimer;
procedure onStatus(axSender: TObject;
const axStatus: TIdStatus;
const asStatusText:
String);
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure OnLogItem(ASender: TComponent;
var AText:
String);
procedure Timer2Timer(Sender: TObject);
private
{ Private declarations }
procedure getfile();
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.onStatus(axSender: TObject;
const axStatus: TIdStatus;
const asStatusText:
String);
begin
DebugListBox.ItemIndex := DebugListBox.Items.Add(asStatusText);
StatusBar1.Panels[0].Text := asStatusText;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
IdFTP1.Connect;
timer2.Enabled:=true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if IdFTP1.Connected = true
then
begin
button1.Visible:=false;
button2.Visible:=true;
edit1.Visible:=true;
button3.Visible:=true;
end;
if IdFTP1.Connected = false
then
begin
button1.Visible:=true;
button2.Visible:=false;
button3.Visible:=false;
button4.Visible:=false;
Label1.Visible:=false;
edit1.Visible:=false;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
IdFTP1.Disconnect;
end;
procedure TForm1.OnLogItem(ASender: TComponent;
var AText:
String);
begin
DebugListBox.ItemIndex := DebugListBox.Items.Add(AText);
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
if IdFTP1.Connected
then
begin
getfile();
timer2.Enabled:=false;
end;
end;
procedure TForm1.getfile();
begin
IdFTP1.Get('
anzeigen.txt', extractfilepath(application.ExeName), true);
end;
end.