Пример #1
0
        private void SetTemplate(SITemplate template)
        {
            _template = template;

            _packageTemplate.Transform   = _template.PackageTemplate[0];
            _roundTemplate.Transform     = _template.RoundTemplate[0];
            _themeTemplate.Transform     = _template.ThemeTemplate[0];
            _questTemplate.Transform     = _template.QuestionTemplate[0];
            _separatorTemplate.Transform = _template.SeparatorTemplate[0];
            _answerTemplate.Transform    = _template.AnswerTemplate[0];

            _packageTemplate.Variants   = new ObservableCollection <string>(_template.PackageTemplate);
            _roundTemplate.Variants     = new ObservableCollection <string>(_template.RoundTemplate);
            _themeTemplate.Variants     = new ObservableCollection <string>(_template.ThemeTemplate);
            _questTemplate.Variants     = new ObservableCollection <string>(_template.QuestionTemplate);
            _separatorTemplate.Variants = new ObservableCollection <string>(_template.SeparatorTemplate);
            _answerTemplate.Variants    = new ObservableCollection <string>(_template.AnswerTemplate);

            BindHelper.Bind(_packageTemplate.Variants, _template.PackageTemplate);
            BindHelper.Bind(_roundTemplate.Variants, _template.RoundTemplate);
            BindHelper.Bind(_themeTemplate.Variants, _template.ThemeTemplate);
            BindHelper.Bind(_questTemplate.Variants, _template.QuestionTemplate);
            BindHelper.Bind(_separatorTemplate.Variants, _template.SeparatorTemplate);
            BindHelper.Bind(_answerTemplate.Variants, _template.AnswerTemplate);
        }
Пример #2
0
        public InfoViewModel(Info model, IItemViewModel owner)
        {
            _model = model;
            Owner  = owner;

            Authors = new AuthorsViewModel(_model.Authors, this);
            Sources = new SourcesViewModel(_model.Sources, this);

            BindHelper.Bind(Authors, _model.Authors);
            BindHelper.Bind(Sources, _model.Sources);
        }
Пример #3
0
        public QuestionViewModel(Question question)
            : base(question)
        {
            Type = new QuestionTypeViewModel(question.Type);

            Right    = new AnswersViewModel(this, question.Right, true);
            Wrong    = new AnswersViewModel(this, question.Wrong, false);
            Scenario = new ScenarioViewModel(this, question.Scenario);

            BindHelper.Bind(Right, question.Right);
            BindHelper.Bind(Wrong, question.Wrong);

            AddWrongAnswers = new SimpleCommand(AddWrongAnswers_Executed);

            Clone  = new SimpleCommand(CloneQuestion_Executed);
            Remove = new SimpleCommand(RemoveQuestion_Executed);

            SetQuestionType = new SimpleCommand(SetQuestionType_Executed);

            Wrong.CollectionChanged += Wrong_CollectionChanged;
        }
Пример #4
0
        protected TextsStorageViewModel(string title, IList <T> sourceList)
        {
            _title      = title;
            _sourceList = sourceList;

            Collection = new ObservableCollection <T>(_sourceList);
            Collection.CollectionChanged += Collection_CollectionChanged;

            BindHelper.Bind(Collection, _sourceList);

            foreach (var item in Collection)
            {
                item.PropertyChanged += Item_PropertyChanged;
            }

            MoveUp   = new SimpleCommand(MoveUp_Executed);
            MoveDown = new SimpleCommand(MoveDown_Executed);
            Add      = new SimpleCommand(Add_Executed);
            Remove   = new SimpleCommand(Remove_Executed);

            CheckCommands();
        }