Indented correctly, you can see the error. The MessageDlg will always show.
if LazAutoUpdate1.NewVersionAvailable then // If NewVersionAvailable block starts here
if WyckerLogLevel = 1 then
begin
Logger.Info(sNewVersionAvailable);
end; // If NewVersionAvailable block ends here
MessageDlg(Application.Title, sNewVersionAvailable, mtConfirmation, [mbOK], 0); // << Outside the If..then block
You need to use Begin..End blocks with every if..then statement to be sure. In general, keep to the rule: '
After a then, always a begin'
Tip1: If you keep to the rule, in the Laz editor pane, when you click on a 'begin' it will highlight the corresponding 'end'
Tip2: When the if.thens behave 'funny' try Jedi Formatting the code - it will show the blocks (and any errors) more clearly. It's the "poor man's syntax checker"
Tip3: Don't worry about source code looking 'wordy' - the compiler strips out 'wordy' stuff anyway so generally it's all the same, and 'wordy' correctly indented code is usually easier to debug and maintain.
This code should do as you want:
if LazAutoUpdate1.NewVersionAvailable then
Begin // If NewVersionAvailable block starts here
if WyckerLogLevel = 1 then
begin
Logger.Info(sNewVersionAvailable);
end;
MessageDlg(Application.Title, sNewVersionAvailable, mtConfirmation, [mbOK], 0); // << Inside the If..then block
end; // If NewVersionAvailable block ends here
Note: When you get Update Pack working, remember use it to update itself and the LazAutoUpdate code every so often. As I write, the LazAutoUpdate suite is still under active development.