示例#1
0
        async Task LoadToCollection(IEnumerable <KinderTask> items)
        {
            await TaskSemaphore.WaitAsync().ConfigureAwait(false);

            using (Tasks.UpdatesBlock()) {
                Tasks.Clear();
                Tasks.AddRange(items);
            }

            TaskSemaphore.Release();
        }
示例#2
0
        async Task RecalculatePoints()
        {
            await TaskSemaphore.WaitAsync().ConfigureAwait(false);

            int pending = 0;

            foreach (var t in Tasks)
            {
                if (!t.IsPending)
                {
                    continue;
                }

                pending    += t.Points;
                t.IsPending = false;
                await dataManager.AddOrSaveKinderTaskAsync(t).ConfigureAwait(false);
            }

            TaskSemaphore.Release();

            Points        = Points + pending;
            PendingPoints = 0;
        }