Skip to content

UI: No feedback after clicking "Update Now" during update download #33

@Computer-Tsu

Description

@Computer-Tsu

Problem

After clicking Update Now in the update banner, there is a multi-second delay with no visual feedback before the Velopack installer prompt appears. The button remains enabled and the status text is unchanged, leaving the user with no indication that anything is happening.

Cause

ApplyUpdate_Click in MainWindow.xaml.cs performs a redundant CheckForUpdateAsync(force: true) network call before starting the download, instead of using the already-resolved _pendingUpdate held by the ViewModel:

// MainWindow.xaml.cs — ApplyUpdate_Click (current)
private async void ApplyUpdate_Click(object sender, RoutedEventArgs e)
{
    if (_vm.HasUpdate is false) return;
    var updateSvc = ((App)Application.Current).GetService<IUpdateService>();
    if (updateSvc is null) return;
    try
    {
        var info = await updateSvc.CheckForUpdateAsync(force: true);  // ← redundant network round-trip
        if (info is not null) await updateSvc.ApplyUpdateAsync(info);
    }
    ...
}

MainViewModel already holds _pendingUpdate and has ApplyUpdateCommand wired to use it directly, but the button uses Click= instead of Command= binding.

Proposed Fix

MainViewModel.cs

  • Add _isApplyingUpdate backing field
  • Add IsApplyingUpdate property (setter notifies CanApplyUpdate and calls CommandManager.InvalidateRequerySuggested)
  • Add CanApplyUpdate computed property: _pendingUpdate is not null && !_isApplyingUpdate
  • Update ApplyUpdateCommand canExecute to () => CanApplyUpdate
  • Update ApplyUpdate() to set IsApplyingUpdate = true and UpdateText = "Downloading update…" before the async work; reset both on failure
  • Update NotifyUpdate() to also notify CanApplyUpdate

MainWindow.xaml

  • Switch "Update Now" button from Click="ApplyUpdate_Click" to Command="{Binding ApplyUpdateCommand}" with IsEnabled="{Binding CanApplyUpdate}"

MainWindow.xaml.cs

  • Remove ApplyUpdate_Click handler (logic moves fully into MainViewModel.ApplyUpdate())

Expected Behaviour

On click:

  1. Button disables immediately
  2. UpdateText changes to "Downloading update…"
  3. Velopack installer prompt appears once download completes
  4. On failure: button re-enables, UpdateText shows the error message

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguiUser interface appearance or behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions