using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using Päevaküsimus.Models; namespace Päevaküsimus { class MainWindowVM:NotificationBase { public ObservableCollection questions { get; set; } private Question _seleceQuestion; public Question selectedQuestion { get { return _seleceQuestion;} set { _seleceQuestion = value; selectedQuestionAnswers = value.answers; NotifyPropertyChanged(); } } private ObservableCollection _selectedQuestionAnswers; public ObservableCollection selectedQuestionAnswers { get { return _selectedQuestionAnswers; } set { _selectedQuestionAnswers = value; NotifyPropertyChanged(); } } private Random _rnd; public MainWindowVM() { this._rnd = new Random(); this.questions = new ObservableCollection(); var question = new Question("Mis värvi on armastus?"); question.AddAnswer(new Answer("Punane", true)); foreach (var color in new [] {"Roheline", "Sinine", "Roosa", "Lilla"}) { question.AddAnswer(new Answer(color)); } this.questions.Add(question); this.questions.Add(new Question("Test")); } public Question GetQuestionOfTheDay() { return this.questions.ElementAt(this._rnd.Next(0, this.questions.Count)); } } }