public async Task <T> EnsureWrapperLoadedAsync([NotNull] AcItemWrapper wrapper) { if (wrapper == null) { throw new ArgumentNullException(nameof(wrapper)); } if (wrapper.IsLoaded) { return((T)wrapper.Value); } var value = await Task.Run(() => CreateAndLoadAcObject(wrapper.Id, wrapper.Value.Enabled, false)); wrapper.Value = value; return(value); }
public T EnsureWrapperLoaded([NotNull] AcItemWrapper wrapper) { if (wrapper == null) { throw new ArgumentNullException(nameof(wrapper)); } lock (wrapper) { if (wrapper.IsLoaded) { return((T)wrapper.Value); } var value = CreateAndLoadAcObject(wrapper.Id, wrapper.Value.Enabled); wrapper.Value = value; return(value); } }
protected void ReplaceInList([NotNull] string oldId, AcItemWrapper newItem) { if (oldId == null) { throw new ArgumentNullException(nameof(oldId)); } var wrapper = GetWrapperById(oldId); if (wrapper == null) { return; } if (wrapper.IsLoaded) { ((AcObjectNew)wrapper.Value).Outdate(); } InnerWrappersList.Replace(wrapper, newItem); UpdateList(true); ResetLoading(); }
protected void AddInList(AcItemWrapper newItem) { InnerWrappersList.Add(newItem); UpdateList(true); ResetLoading(); }
public CarOrOnlyCarIdEntry(string carId, AcItemWrapper carObjectWrapper = null) { CarId = carId; CarObjectWrapper = carObjectWrapper; }