Ejemplo n.º 1
0
        public IDependencyViewModel CreateDependencyViewModel(IDependency dependency)
        {
            switch (dependency)
            {
            case IConditionResultDependency conditionResultDependency:

                if (conditionResultDependency.Condition == null)
                {
                }
                var resultList      = _resultFillHelper.CreateEmptyResultViewModels();
                var conditionsList  = _conditionFillHelper.CreateEmptyAvailableConditionViewModels();
                var actualResult    = _resultFillHelper.CreateResultViewModel(conditionResultDependency.Result);
                var actualCondition =
                    _conditionFillHelper.CreateConditionViewModel(conditionResultDependency.Condition);
                resultList.ReplaceStronglyNamedInCollection(actualResult);
                conditionsList.ReplaceStronglyNamedInCollection(actualCondition);
                return(new ConditionResultDependencyViewModel(resultList,
                                                              conditionsList)
                {
                    SelectedConditionViewModel = actualCondition,
                    SelectedResultViewModel = actualResult
                });

                break;

            default:

                break;
            }

            return(null);
        }
Ejemplo n.º 2
0
        public IFilterViewModel CreateFilterViewModel(IFilter filter)
        {
            switch (filter)
            {
            case DefaultFilter defaultFilter:
                return(new FilterViewModel(defaultFilter.Conditions
                                           .Select(condition => _conditionFillHelper.CreateConditionViewModel(condition))
                                           .ToObservableCollection())
                {
                    Name = defaultFilter.Name
                });
            }

            return(null);
        }