TDownloadURL.AfterDownload的正确参数列表是什么

时间:2014-08-25 16:48:42

标签: delphi delphi-xe4

{ Download the license file with expiration date }
  iDownloadURL := TDownloadURL.Create(nil);
  try
    iBaseURL := DomainName1.Text;
    iDownloadURL.FileName := ATempFilesFolder + UserName1.Text + 'lcn';
    iDownloadURL.url := iBaseURL;
    iDownloadURL.OnDownloadProgress := URL_OnDownloadProgress;
    iDownloadURL.AfterDownload := AfterDownloadLicense; {License is validated here }
    iDownloadURL.ExecuteTarget(nil);
  finally
    { If a connection fails then a dialog will appear that shows an error.
    If running in the ide then an exception box will appear, Press the continue
    button... then the message will be shown }
    iDownloadURL.Free;
    StatusBar1.SimpleText := 'Failed validation connection...';
    Form1.StatusBar1.SimpleText := 'Failed validation connection...';
  end;

procedure TFormDomainSettings.AfterDownloadLicense;
begin
  if not FileExists(ATempFilesFolder + UserName1.Text + 'lcn') then
  begin
    TaskMessageDlg('Error Downloading License File',
      'The license file could not be downloaded.', mtWarning, [mbOk], 0);
  end
  else
  begin
    ValidateLicense;
  end;
end;

如何分配iDownloadURL.AfterDownload:= AfterDownloadLicense; TNotifyEvent?

1 个答案:

答案 0 :(得分:2)

您可以在documentation中查找,或者甚至使用IDE编辑器在TNotifyEvent中查找System.Classes.pas声明:

TNotifyEvent = procedure(Sender: TObject) of object;

话虽如此,AfterDownloadLicense()需要看起来像这样:

procedure TFormDomainSettings.AfterDownloadLicense(Sender: TObject);