Example #1
0
        private void AddAnswer(AnswerViewModel answer)
        {
            AttachEvents(answer);
            _answers.Add(answer);

            RaiseAnswerAdded(answer.Answer);

            _logger.Log(Level.Trace, "Added a new answer to the question.");
        }
Example #2
0
 private void DettachEvents(AnswerViewModel answer)
 {
     answer.PropertyChanged -= AnswerPropertyChanged;
     answer.IsDirtyChangedEvent -= IsDirtyHandler;
     answer.RequestsRemovalEvent -= RequestAnswerRemoval;
 }
Example #3
0
        private void RequestAnswerAddition()
        {
            AnswerViewModel vm = new AnswerViewModel(
                new Answer(),
                _answerValidator,
                _subjectValidator,
                 _subjectQuery,
                _busId
            );

            AddAnswer(vm);

            CollectionViewSource.GetDefaultView(_answers).MoveCurrentTo(vm);
        }
Example #4
0
        private void RemoveAnswer(AnswerViewModel answer)
        {
            DettachEvents(answer);
            _answers.Remove(answer);

            RaiseAnswerRemoved(answer.Answer);

            _logger.Log(Level.Trace, "Removed an answer from the question.");
        }