private async Task <ActionObservableSortedSet> LoadActionsByYear(ActionObservableSortedSet actions, int year) { var respond = await ActionEvent.GetActionsByYear((int)Zal.Session.UserRank, year); return(new ActionObservableSortedSet(respond.ActiveRecords) { LastSynchronization = respond.Timestamp }); }
private Task <ActionObservableSortedSet> Synchronize(ActionObservableSortedSet actions, int year) { if (actions.LastSynchronization == ZAL.DATE_OF_ORIGIN) { return(LoadActionsByYear(actions, year)); } else { return(LoadChangesByYear(actions, year)); } }
private async Task <ActionObservableSortedSet> LoadChangesByYear(ActionObservableSortedSet actions, int year) { var respond = await ActionEvent.GetChangedAsync((int)Zal.Session.UserRank, actions.LastSynchronization, year, actions.Count); if (respond.IsHardChanged) { actions.Clear(); actions.AddAll(respond.Changed); actions.LastSynchronization = respond.Timestamp; } else if (respond.IsChanged) { actions.RemoveByIds(respond.Deleted); actions.AddOrUpdateAll(respond.Changed); actions.LastSynchronization = respond.Timestamp; } return(actions); }
public ActionSet() { UpcomingActionEvents = new ActionObservableSortedSet(); ActionEventsDict = new Dictionary <int, ActionObservableSortedSet>(); ShownYear = DateTime.Today.Year; }