public bool ImmediateChange(Uri uri) { var carId = uri.GetQueryParam("CarId"); if (carId == null || carId != _carId) { return(false); } var id = uri.GetQueryParam("Id"); if (id == null) { return(false); } var source = uri.GetQueryParamEnum <CarSetupsRemoteSource>("RemoteSource"); if (source == CarSetupsRemoteSource.None) { return(false); } var obj = RemoteSetupsManager.GetManager(_source, carId)?.GetById(id); if (obj == null) { return(false); } _object = obj; SetModel(); return(true); }
void ILoadableContent.Load() { do { _carObject = CarsManager.Instance.GetById(_carId); if (_carObject == null) { _object = null; return; } _object = RemoteSetupsManager.GetManager(_source, _carId)?.GetById(_id); } while (_carObject.Outdated); }
public RemoteCarSetupObject(RemoteSetupsManager manager, RemoteSetupInformation information) : base(manager, information.Id, true) { _information = information; Source = manager.Source; CarId = _information.CarId; TrackId = _information.TrackKunosId; Author = _information.Author; Version = _information.Version; Downloads = _information.Downloads; CommunityRating = _information.CommunityRating; Trim = _information.Trim; BestTime = _information.BestTime; _track = new Lazy <TrackObject>(() => TrackId == null ? null : TracksManager.Instance.GetLayoutByKunosId(TrackId)?.MainTrackObject); }
async Task ILoadableContent.LoadAsync(CancellationToken cancellationToken) { do { _carObject = await CarsManager.Instance.GetByIdAsync(_carId); if (_carObject == null) { _object = null; return; } await Task.Run(() => { _carObject.AcdData?.GetIniFile("car.ini"); _carObject.AcdData?.GetIniFile("setup.ini"); _carObject.AcdData?.GetIniFile("tyres.ini"); }, cancellationToken); _object = RemoteSetupsManager.GetManager(_source, _carId)?.GetById(_id); } while (_carObject.Outdated); }