AcManager.Tools.Profile.LapTimesStorage.IsBetter C# (CSharp) Метод

IsBetter() публичный Метод

public IsBetter ( [ entry ) : bool
entry [
Результат bool
        public bool IsBetter([NotNull] LapTimeEntry entry) {
            if (entry == null) throw new ArgumentNullException(nameof(entry));
            var existing = GetLapTime(entry.CarId, entry.TrackAcId);
            return existing == null || existing.LapTime > entry.LapTime;
        }
    }

Usage Example

Пример #1
0
        public async Task AddEntryAsync(LapTimeEntry entry)
        {
            await EnsureActualAsync();

            try {
                if (!_storage.IsBetter(entry))
                {
                    Logging.Debug($"Better entry available ({Id})");
                    return;
                }

                Logging.Debug($"New entry ({Id}): {entry.LapTime}");

                SetDirty();
                _storage.Set(entry);

                if (_readerFunc != null)
                {
                    using (var reader = _readerFunc()) {
                        reader.Export(new[] { entry });
                        _storage.SyncLastModified(reader);
                    }
                }

                OnPropertyChanged(nameof(LastModified));
                OnPropertyChanged(nameof(EntriesCount));
            } catch (Exception e) {
                Logging.Error(e);
            }
        }
All Usage Examples Of AcManager.Tools.Profile.LapTimesStorage::IsBetter