diff --git a/components/lazautoupdate/latest_stable/testapp/testapp.lps b/components/lazautoupdate/latest_stable/testapp/testapp.lps index 881be909e..f8f888a87 100644 --- a/components/lazautoupdate/latest_stable/testapp/testapp.lps +++ b/components/lazautoupdate/latest_stable/testapp/testapp.lps @@ -4,13 +4,13 @@ - + - + @@ -20,40 +20,40 @@ - - - + + + - + - + - + - - + + - - + + @@ -61,7 +61,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -120,7 +120,7 @@ - + @@ -144,6 +144,15 @@ + + + + + + + + + @@ -151,87 +160,87 @@ - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + @@ -239,35 +248,35 @@ - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/components/lazautoupdate/latest_stable/testapp/umainform.lfm b/components/lazautoupdate/latest_stable/testapp/umainform.lfm index 4e93a4984..0faf83051 100644 --- a/components/lazautoupdate/latest_stable/testapp/umainform.lfm +++ b/components/lazautoupdate/latest_stable/testapp/umainform.lfm @@ -1,7 +1,7 @@ object mainform: Tmainform - Left = 682 + Left = 558 Height = 209 - Top = 277 + Top = 210 Width = 335 BorderIcons = [biSystemMenu] Caption = 'mainform' @@ -9,6 +9,7 @@ object mainform: Tmainform ClientWidth = 335 OnActivate = FormActivate OnCreate = FormCreate + OnDestroy = FormDestroy Position = poDesktopCenter LCLVersion = '1.7' Visible = True diff --git a/components/lazautoupdate/latest_stable/testapp/umainform.pas b/components/lazautoupdate/latest_stable/testapp/umainform.pas index 1af6be368..dcb2ff518 100644 --- a/components/lazautoupdate/latest_stable/testapp/umainform.pas +++ b/components/lazautoupdate/latest_stable/testapp/umainform.pas @@ -6,26 +6,31 @@ interface uses Classes, SysUtils, Forms, ComCtrls, - Buttons, StdCtrls,ulazautoupdate; + Buttons, StdCtrls,LazFileUtils,FileUtil, + ulazautoupdate,eventlog; CONST {$IFDEF WINDOWS} {$IFDEF CPU32} C_VERSIONSINNAME = 'testappwin32.ini'; C_ZIPFILENAME = 'testappwin32.zip'; + C_LogFileName = 'testappwin32log.txt'; {$ENDIF} {$IFDEF CPU64} C_VERSIONSINNAME = 'testappwin64.ini'; C_ZIPFILENAME = 'testappwin64.zip'; + C_LogFileName = 'testappwin64log.txt'; {$ENDIF} {$ENDIF} {$IFDEF LINUX} {$IFDEF CPU32} C_VERSIONSINNAME = 'testapplinux32.ini'; C_ZIPFILENAME = 'testapplinux32.zip'; + C_LogFileName = 'testapplinux32log.txt'; {$ENDIF} {$IFDEF CPU64} C_VERSIONSINNAME = 'testapplinux64.ini'; C_ZIPFILENAME = 'testapplinux64.zip'; + C_LogFileName = 'testapplinux64log.txt'; {$ENDIF} {$ENDIF} @@ -50,6 +55,7 @@ type procedure cmd_updateToNewVersionClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); procedure LazAutoUpdate1DebugEvent(Sender: TObject; lauMethodName, lauMessage: string); procedure LazAutoUpdate1Downloaded(Sender: TObject; ResultCode, @@ -57,7 +63,8 @@ type procedure LazAutoUpdate1NewVersionAvailable(Sender: TObject; Newer: boolean; OnlineVersion: string); private - + Logger: TEventLog; + procedure WriteAndLog(szText: string); public end; @@ -70,6 +77,10 @@ implementation {$R *.lfm} { Tmainform } +procedure Tmainform.WriteAndLog(szText: string); +begin + Logger.Info(szText); +end; procedure Tmainform.FormCreate(Sender: TObject); begin @@ -78,6 +89,19 @@ begin LazAutoUpdate1.ZipfileName:=C_ZIPFILENAME; lbl_Version.Caption:='Version: ' + LazAutoUpdate1.AppVersion; Caption:=Application.Title; + if FileExistsUTF8(C_LogFileName) then + DeleteFile(C_LogFileName); + Logger := TEventLog.Create(nil); + Logger.LogType := ltFile; + Logger.FileName := C_LogFileName; + Logger.Active := True; + Logger.Info('Start of Log'); +end; + +procedure Tmainform.FormDestroy(Sender: TObject); +begin + Logger.Info('End of Log'); + FreeAndNil(Logger); end; procedure Tmainform.cmd_NewVersionAvailableClick(Sender: TObject); @@ -114,6 +138,7 @@ procedure Tmainform.LazAutoUpdate1DebugEvent(Sender: TObject; lauMethodName, lauMessage: string); begin StatusBar1.SimpleText:='Debug Message: (' + lauMethodName + ') ' + lauMessage; + WriteAndLog(StatusBar1.SimpleText); end; procedure Tmainform.LazAutoUpdate1Downloaded(Sender: TObject; ResultCode, @@ -121,6 +146,7 @@ procedure Tmainform.LazAutoUpdate1Downloaded(Sender: TObject; ResultCode, begin StatusBar1.SimpleText:=Format('Downloaded. StatusCode=%d BytesDownloaded=%d', [ResultCode,BytesDownloaded]); + WriteAndLog(StatusBar1.SimpleText); end; procedure Tmainform.LazAutoUpdate1NewVersionAvailable(Sender: TObject; @@ -129,7 +155,9 @@ begin If Newer then StatusBar1.SimpleText:='New version available. Online Version is ' + OnlineVersion else - StatusBar1.SimpleText:='Online version is not newer. Online Version is ' + OnlineVersion + StatusBar1.SimpleText:='Online version is not newer. Online Version is ' + OnlineVersion; + + WriteAndLog(StatusBar1.SimpleText); end;