Skip to content

Commit

Permalink
Blazor doesn't delete completed jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
jtheisen committed Jan 25, 2023
1 parent 1c1f7a4 commit bc4f078
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion SampleApp.BlazorWebAssembly/Pages/JobListPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Show rerender info
</label>
</div>
<button class="btn btn-warning" @onclick="jobList.CancelCommand.Execute">Cancel job</button>
<button class="btn btn-warning ms-auto" disabled="@jobList.CancelCommand.IsDisabled" @onclick="jobList.CancelCommand.Execute">Cancel job</button>
</div>

<div class="items mt-4">
Expand Down
2 changes: 0 additions & 2 deletions SampleApp.Wpf/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public MainWindow()

var jobList = app.JobList;

jobList.AddSimpleJobCommand.Execute(null);

JobList.DataContext = jobList;
}
}
Expand Down
5 changes: 5 additions & 0 deletions SampleApp/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ async void AddAndRunJob(Job job)
await Task.Delay(3000);

Items.Remove(job);

if (Items.Count == 0)
{
Cts = null;
}
}

void Cancel()
Expand Down

0 comments on commit bc4f078

Please sign in to comment.