public void ReceivedEvent(CacheType type) { if (!RefreshEvents.ContainsKey(type)) { RefreshEvents.Add(type, 0); } var val = RefreshEvents[type] - 1; RefreshEvents[type] = val > -1 ? val : 0; if (IsRefreshing && !RefreshEvents.Values.Any(x => x > 0)) { DoneRefreshing(); } }
public void Refresh(CacheType type) { if (Repository == null) { return; } IsRefreshing = true; if (!RefreshEvents.ContainsKey(type)) { RefreshEvents.Add(type, 0); } RefreshEvents[type]++; Repository.Refresh(type); }