예제 #1
0
        public Dictionary <string, bool> GetBadgesStates(List <BadgeAction> badgesUserResult)
        {
            var result = new Dictionary <string, bool>();

            foreach (BadgeType badgeType in AppModel.Instance.BadgeTypes.Items)
            {
                bool isEnabled             = false;
                List <BadgeAction> actions = badgesUserResult.FindAll(temp => temp.Id.Equals(badgeType.Id));
                isEnabled = AppResources.IsBadgeEnabled(badgeType.Id, actions.Count);
                result.Add(badgeType.Id, isEnabled);
            }

            return(result);
        }
예제 #2
0
        public bool GetBadgeState(BadgeType badge)
        {
            AppBadgeType appBadgeType = AppResources.BadgeTypes[badge.Id];

            List <BadgeAction> actions;

            switch (appBadgeType)
            {
            case AppBadgeType.ConnectTo10Users:
            case AppBadgeType.ConnectTo3Users:
            case AppBadgeType.ConnectTo50Users:
                string badgeId = AppResources.GetBadgeIdByType(AppBadgeType.ConnectTo50Users);
                actions = BadgeActions.Items.FindAll(temp => temp.Badge.Equals(badgeId));
                break;

            default:
                actions = BadgeActions.Items.FindAll(temp => temp.Badge.Equals(badge.Id));
                break;
            }

            return(AppResources.IsBadgeEnabled(badge.Id, actions.Count));
        }