public override void Execute(object parameter) { OnlineExamsViewModel onlineExamsViewModel = new OnlineExamsViewModel(); OnlineExamControl onlineExamControl = new OnlineExamControl(); onlineExamsViewModel.SingleQuestionPanel = onlineExamControl.SingleQuestionPanel; onlineExamControl.DataContext = onlineExamsViewModel; for (int i = 0; i < 25; i++) // or iterate in DB.Questions { SingleQuestionViewModel questionViewModel = new SingleQuestionViewModel(); questionViewModel.Question = "TEST" + i; SingleQuestionControl control = new SingleQuestionControl(); control.DataContext = questionViewModel; onlineExamsViewModel.QuestionControls.Add(control); } MainWindow mainWindow = (MainWindow)mainViewModel.Window; mainWindow.GrdCenter.Children.Clear(); mainWindow.GrdCenter.Children.Add(onlineExamControl); onlineExamsViewModel.CurrentQuestion = 0; }
public override void Execute(object parameter) { if (test) { viewModel.CurrentQuestion++; test = false; } else { viewModel.CurrentQuestion--; test = true; } return; OnlineExamsViewModel onlineExamsViewModel = new OnlineExamsViewModel(); ChooseExam chooseExam = new ChooseExam(); QuestionsViewModel questionsViewModel = new QuestionsViewModel(); questionsViewModel.Exams = DataProvider.GetExams(); questionsViewModel.Subjects = DataProvider.GetSubjects(); chooseExam.DataContext = questionsViewModel; chooseExam.ShowDialog(); if (chooseExam.DialogResult == true) { //questionsViewModel.CurrentQuestion = DataProvider.GetQuestions(); } }
public FinishOnlineExamCommand(OnlineExamsViewModel viewmodel) : base(viewmodel) { }
public StartOnlineExamCommand(OnlineExamsViewModel viewmodel) : base(viewmodel) { }
public BaseOnlineExamCommand(OnlineExamsViewModel viewModel) { this.viewModel = viewModel; }