43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.ObjectModel;
|
|
|
|
namespace Päevaküsimus.Models
|
|
{
|
|
[Serializable()]
|
|
public class Question : NotificationBase, ICloneable
|
|
{
|
|
private string _question;
|
|
public string question {
|
|
get { return _question; }
|
|
set
|
|
{
|
|
_question = value;
|
|
NotifyPropertyChanged();
|
|
}
|
|
}
|
|
private ObservableCollection<Answer> _answers;
|
|
public ObservableCollection<Answer> answers { get { return _answers; } }
|
|
|
|
public Question(string question)
|
|
{
|
|
this.question = question;
|
|
this._answers = new ObservableCollection<Answer>();
|
|
}
|
|
|
|
public void AddAnswer(Answer answer)
|
|
{
|
|
_answers.Add(answer);
|
|
}
|
|
|
|
public object Clone()
|
|
{
|
|
var q = new Question(_question.Clone() as string);
|
|
foreach (var answer in _answers)
|
|
{
|
|
q.AddAnswer(answer.Clone() as Answer);
|
|
}
|
|
return q;
|
|
}
|
|
}
|
|
} |