Esempio n. 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);
            }
        }
Esempio n. 2
0
        public override bool Equals(object obj)
        {
            var comp = new MembershipComparer();

            return(comp.Equals(this, obj as Membership));
        }