Beispiel #1
0
        public void LocalRefresh()
        {
            try
            {
                League.LocalRefresh();

                var memberships = Memberships.Select(vm => vm.Membership).ToList();

                var comparer = new MembershipComparer();
                var toRemove = memberships.Except(League.Memberships, comparer).ToList();
                var toAdd    = League.Memberships.Except(memberships, comparer).ToList();

                toRemove.ForEach(m => Memberships.Remove(Memberships.Single(vm => vm.Membership == m)));

                toAdd.ForEach(m => Memberships.Add(new MembershipViewModel {
                    MembershipId = m.Id
                }));

                Memberships.Sort(new MembershipSortComparer());
                Memberships.ToList().ForEach(vm => vm.NotifyPropertiesChanged());

                if (Memberships.Count == 0)
                {
                    Memberships.Add(new MembershipViewModel {
                        EmptyMessage = "This league has no members yet"
                    });
                }
            }
            catch (Exception e)
            {
                InsightsManager.Report(e);
            }
        }
Beispiel #2
0
        public void LocalRefresh(bool refreshLeagues = true)
        {
            if (Athlete != null)
            {
                Athlete.LocalRefresh();
            }

            if (League != null && refreshLeagues)
            {
                League.LocalRefresh();
            }
        }