2017-01-26 17:50:33 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
|
|
|
|
|
namespace Päevaküsimus.Models
|
|
|
|
|
{
|
2017-01-26 19:32:16 +02:00
|
|
|
|
[Serializable()]
|
|
|
|
|
public class Question : NotificationBase, ICloneable
|
2017-01-26 17:50:33 +02:00
|
|
|
|
{
|
2017-01-26 19:32:16 +02:00
|
|
|
|
private string _question;
|
|
|
|
|
public string question {
|
|
|
|
|
get { return _question; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_question = value;
|
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-01-26 17:50:33 +02:00
|
|
|
|
private ObservableCollection<Answer> _answers;
|
2017-01-26 19:32:16 +02:00
|
|
|
|
public ObservableCollection<Answer> answers { get { return _answers; } }
|
2017-01-26 17:50:33 +02:00
|
|
|
|
|
|
|
|
|
public Question(string question)
|
|
|
|
|
{
|
|
|
|
|
this.question = question;
|
|
|
|
|
this._answers = new ObservableCollection<Answer>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddAnswer(Answer answer)
|
|
|
|
|
{
|
|
|
|
|
_answers.Add(answer);
|
|
|
|
|
}
|
2017-01-26 19:32:16 +02:00
|
|
|
|
|
|
|
|
|
public object Clone()
|
|
|
|
|
{
|
|
|
|
|
var q = new Question(_question.Clone() as string);
|
|
|
|
|
foreach (var answer in _answers)
|
|
|
|
|
{
|
|
|
|
|
q.AddAnswer(answer.Clone() as Answer);
|
|
|
|
|
}
|
|
|
|
|
return q;
|
|
|
|
|
}
|
2017-01-26 17:50:33 +02:00
|
|
|
|
}
|
|
|
|
|
}
|