void ILoadActionProcesses.LoadRules()
        {
            _actionContainer.ActionCategory = EnumActionCategory.Rules;
            var tempList = _gameContainer.SaveRoot !.RuleList.Where(items => items.Category != EnumRuleCategory.Basic).Select(items => items.Text()).ToCustomBasicList();

            if (tempList.Count == 0)
            {
                throw new BasicBlankException("Cannot load the rules because there are no rules");
            }
            if (_gameContainer.CurrentAction !.Deck == EnumActionMain.TrashANewRule)
            {
                _actionContainer.Rule1 !.SelectionMode = ListViewPicker.EnumSelectionMode.SingleItem;
                _actionContainer.RulesToDiscard        = 1;
            }
Example #2
0
        private void ExecuteCheckCommand(object state)
        {
            Feedbacks.Clear();

            foreach (var currentRule in RuleList.Where(x => x.IsSelected))
            {
                List <RuleFeedbackBase> fb;
                List <CheckerFeedback>  cb;

                ///////////////////
                // TODO: this is really slow while we call the elaborator as many times as many rules require it.
                ///////////////////
                _checker.CheckRule(currentRule.Rule, out fb, out cb);

                if (fb.Any(x => x.FeedbackType == FeedbackTypes.Error))
                {
                    currentRule.ResultType = ResultTypes.Error;
                }
                else if (fb.Any(x => x.FeedbackType == FeedbackTypes.Warning))
                {
                    currentRule.ResultType = ResultTypes.Warning;
                }
                else
                {
                    currentRule.ResultType = ResultTypes.Ok;
                }

                if (cb.Any(x => x.CheckerResultType == CheckerResultTypes.InvalidContext))
                {
                    currentRule.CheckerResultType = CheckerResultTypes.InvalidContext;
                }
                else
                {
                    currentRule.CheckerResultType = CheckerResultTypes.Ok;
                }
            }
        }