unit Form.Principal;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uClass.FuncionalCard, Vcl.StdCtrls,
  Vcl.ExtCtrls, Vcl.Buttons;

type
  TForm1 = class(TForm)
    FuncionalCardWeb1: TFuncionalCardWeb;
    edtPathReq: TLabeledEdit;
    edtPathResp: TLabeledEdit;
    edtNomeArquivo: TLabeledEdit;
    btnSelPathReq: TSpeedButton;
    btnSelPathResp: TSpeedButton;
    OpenDialog1: TOpenDialog;
    cmbAmbiente: TComboBox;
    edtCNPJ: TLabeledEdit;
    edtLogin: TLabeledEdit;
    edtSenha: TLabeledEdit;
    Label1: TLabel;
    Timer1: TTimer;
    procedure btnSelPathReqClick(Sender: TObject);
    procedure btnSelPathRespClick(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    Function BuscaPasta:String;
    procedure ConsultaCartao(NumCartao:string);
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
uses FileCtrl;

{$R *.dfm}

procedure TForm1.btnSelPathReqClick(Sender: TObject);
begin
  edtPathReq.Text := BuscaPasta;
end;

procedure TForm1.btnSelPathRespClick(Sender: TObject);
begin
  edtPathResp.Text := BuscaPasta;
end;

function TForm1.BuscaPasta:String;
var
  Dir: string;
begin
  Result := ExtractFileDir(Application.ExeName)+'\';

  if DirectoryExists(edtPathResp.Text) then
    Dir := edtPathResp.Text
  else
    Dir := Result;

  if SelectDirectory(Dir, [sdAllowCreate, sdPerformCreate, sdPrompt], 0) then
    Result := Dir + '\';


end;

procedure TForm1.ConsultaCartao(NumCartao:string);
begin
 FuncionalCardWeb1.ConsultarCartao(NumCartao);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
  var
    arq:string;
begin
  arq := Trim(edtPathReq.Text) + Trim(edtNomeArquivo.Text);
  if FileExists(arq) then
  begin

  end;

end;

end.
