public async Task RemoveEntryAsync(LapTimeEntry entry) { if (EnabledSources.Any(x => x.ReadOnly)) { NonfatalError.Notify("Can’t remove entry from read-only sources", $"Please, disable {EnabledSources.Where(x => x.ReadOnly).Select(x => x.DisplayName).JoinToReadableString()}.", solutions: new[] { new NonfatalErrorSolution("Disable read-only sources", null, token => { foreach (var source in EnabledSources) { source.IsEnabled = false; } RaiseEntriesChanged(); return(Task.Delay(0)); }), }); return; } var car = CarsManager.Instance.GetById(entry.CarId)?.DisplayName ?? entry.CarId; var track = TracksManager.Instance.GetLayoutByKunosId(entry.TrackId)?.LayoutName ?? entry.TrackId; if (ModernDialog.ShowMessage($"Are you sure you want to remove {car} on {track} lap time?", "Remove Lap Time", MessageBoxButton.YesNo) != MessageBoxResult.Yes) { return; } try { using (WaitingDialog.Create("Deleting…")) { var changed = false; foreach (var source in EnabledSources) { changed |= await source.RemoveAsync(entry.CarId, entry.TrackId); } if (changed) { Logging.Debug("Removed"); RaiseEntriesChanged(); } } } catch (Exception e) { NonfatalError.Notify("Can’t remove entry", e); } }