Пример #1
0
        public void Execute(IWindowManager windowManager, IQuestionDialog questionDialog)
        {
            var question = new Question(
                null,
                Text,
                _possibleAnswers
                );

            questionDialog.Setup(
                Caption,
                new[] {question}
                );

            questionDialog.WasShutdown += delegate{
                if(_handleResult != null)
                    _handleResult(question.Answer);
                else if(question.Answer == Answer.No || question.Answer == Answer.Cancel)
                {
                    Completed(this, new CancelResult());
                    return;
                }

                Completed(this, null);
            };

            windowManager.ShowDialog(questionDialog, null, null);
        }
Пример #2
0
 public void Save(Question question)
 {
     if (question == null) throw new ArgumentNullException("question");
     if (_store.ContainsKey(question.Id))
         _store[question.Id] = question;
     else
         _store.Add(question.Id, question);
 }