{ 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?
答案 0 :(得分:2)
您可以在documentation中查找,或者甚至使用IDE编辑器在TNotifyEvent
中查找System.Classes.pas
声明:
TNotifyEvent = procedure(Sender: TObject) of object;
话虽如此,AfterDownloadLicense()
需要看起来像这样:
procedure TFormDomainSettings.AfterDownloadLicense(Sender: TObject);