Exemplo n.º 1
0
        public QuizModeViewModel(IWindowManager windowManager, ConnectionToDBModel db)
        {
            this._windowManager = windowManager;
            GUIstringsModel strings = new GUIstringsModel();

            this.DescriptionLabel           = strings.GetGUIstr("DescriptionLabel");
            this.AvailableTestsLabel        = strings.GetGUIstr("AvailableTestsLabel");
            this.NumberOfQuestionsLabel     = strings.GetGUIstr("NumberOfQuestionsLabel");
            this.StartQuizButton            = strings.GetGUIstr("StartQuizButton");
            this.QuestionNumberForQuizLabel = strings.GetGUIstr("QuestionNumberForQuizLabel");
            this.PercentToPassLabel         = strings.GetGUIstr("PercentToPassLabel");
            this.TimeLabel = strings.GetGUIstr("TimeLabel");

            Task.Run(() =>
            {
                this.Tests = db.GetTests();
                this.Refresh();
            });

            this.QuestionNumberForQuizFieldBackground = "White";
            this.PercentToPassFieldBackground         = "White";
            this.TimeFieldBackground = "White";
            this.StartQuizIsEnabled  = "False";

            this.QuestionNumberForQuizFieldIsEnabled = "False";
            this.PercentToPassFieldIsEnabled         = "False";
            this.TimeFieldIsEnabled = "False";
        }
        public EditQuestionViewModel(IWindowManager windowManager, EventAggregator eventAggregator, ConnectionToDBModel db)
        {
            this._windowManager   = windowManager;
            this._eventAggregator = eventAggregator;
            this.Db = db;

            this.editQuestionDuringDeleting = null;

            GUIstringsModel strings = new GUIstringsModel();

            this.AvailableQuestionsLabel = strings.GetGUIstr("AvailableQuestionsLabel");
            this.EditQuestionButton      = strings.GetGUIstr("EditQuestionButton");
            this.CreateQuestionButton    = strings.GetGUIstr("CreateQuestionButton");
            this.DeleteQuestionButton    = strings.GetGUIstr("DeleteQuestionButton");
            this.QuestionCantBeDeleted   = strings.GetGUIstr("QuestionCantBeDeleted");
            this.OnlyQuestion            = strings.GetGUIstr("OnlyQuestion");

            Task.Run(() =>
            {
                this.Questions = this.Db.GetQuestions();
                this.Refresh();
            });
            this.EditQuestionButtonIsEnabled   = "False";
            this.DeleteQuestionButtonIsEnabled = "False";
        }
        public EditQuestionPopUpViewModel(ConnectionToDBModel db, EventAggregator eventAggregator, QuestionModel selectedQuestion)
        {
            this._selectedQuestion = selectedQuestion;
            this._db = db;
            this._eventAggregator = eventAggregator;

            this.Answers = new BindableCollection <AnswerModel>();
            foreach (AnswerModel a in selectedQuestion.Answers)
            {
                this.Answers.Add(new AnswerModel(a.IdDB, a.Answer, a.Correct));
            }
            this.QuestionTextValue = selectedQuestion.QuestionText;

            this._readyToRead = false;

            GUIstringsModel strings = new GUIstringsModel();

            this.EditQuestionOnView   = strings.GetGUIstr("EditQuestionOnView");
            this.AnswersLabel         = strings.GetGUIstr("AnswersLabel");
            this.AnswerTextLabel      = strings.GetGUIstr("AnswerTextLabel");
            this.IsCorrectLabel       = strings.GetGUIstr("IsCorrectLabel");
            this.ConfirmEditionButton = strings.GetGUIstr("ConfirmEditionButton");
            this.QuestionTextLabel    = strings.GetGUIstr("QuestionTextLabel");
            this.DeleteAnswerButton   = strings.GetGUIstr("DeleteAnswerButton");
            this.NewAnswerButton      = strings.GetGUIstr("NewAnswerButton");
            this.NewAnswerValueString = strings.GetGUIstr("NewAnswerValueString");
        }
Exemplo n.º 4
0
        public LearnModeViewModel(IWindowManager windowManager, ConnectionToDBModel db)
        {
            this._windowManager = windowManager;
            GUIstringsModel strings = new GUIstringsModel();

            this.DescriptionLabel       = strings.GetGUIstr("DescriptionLabel");
            this.AvailableTestsLabel    = strings.GetGUIstr("AvailableTestsLabel");
            this.NumberOfQuestionsLabel = strings.GetGUIstr("NumberOfQuestionsLabel");
            this.StartLearningButton    = strings.GetGUIstr("StartLearningButton");

            Task.Run(() =>
            {
                this.Tests = db.GetTests();
                this.Refresh();
            });

            this.StartLearnButtonIsEnabled = "False";
        }
Exemplo n.º 5
0
        public LearnPopUpViewModel(TestModel selectedTest)
        {
            GUIstringsModel strings = new GUIstringsModel();

            this.LearnWindowTitle       = strings.GetGUIstr("LearnWindowTitle");
            this.QuestionLabel          = strings.GetGUIstr("QuestionLabel");
            this.ResultLabel            = strings.GetGUIstr("ResultLabel");
            this.ConfirmButton          = strings.GetGUIstr("ConfirmButton");
            this.NextQuestionButton     = strings.GetGUIstr("NextQuestionButton");
            this.MessageBoxResult       = strings.GetGUIstr("MessageBoxResult");
            this.MessageBoxYourResultIs = strings.GetGUIstr("MessageBoxYourResultIs");

            this.LearnMechanism = new TestForLearnModel(selectedTest);

            this.FeedbackColor               = "White";
            this.AnswersIsEnabled            = "True";
            this.ConfirmButtonIsEnabled      = "True";
            this.NextQuestionButtonIsEnabled = "False";
        }
        public EditTestPopUpViewModel(ConnectionToDBModel db, EventAggregator eventAggregator, TestModel selectedTest)
        {
            this._db              = db;
            this._selectedTest    = selectedTest;
            this._eventAggregator = eventAggregator;

            this._eventAggregator.Subscribe(this);

            this.Questions = new BindableCollection <QuestionModel>();
            Task.Run(() =>
            {
                var taskDB     = db.GetQuestions();
                this.Questions = taskDB;
                foreach (QuestionModel q in this.Questions)
                {
                    foreach (QuestionModel qTest in this._selectedTest.Questions)
                    {
                        if (q.IdDB == qTest.IdDB)
                        {
                            q.IsSelected = true;
                        }
                    }
                }
                this.Refresh();
            });

            this._readyToRead = false;

            GUIstringsModel strings = new GUIstringsModel();

            this.EditTestTitle        = strings.GetGUIstr("EditTestTitle");
            this.QuestionsInTestLabel = strings.GetGUIstr("QuestionsInTestLabel");
            this.ConfirmEditionButton = strings.GetGUIstr("ConfirmEditionButton");
            this.TitleLabel           = strings.GetGUIstr("TitleLabel");
            this.DescriptionLabel     = strings.GetGUIstr("DescriptionLabel");

            this.TitleValue       = this._selectedTest.Title;
            this.DescriptionValue = this._selectedTest.Description;

            ConfirmButtonTryToEnable();
        }
Exemplo n.º 7
0
        public ShellViewModel()
        {
            this._eventAggregator = new EventAggregator();
            this._windowManager   = new WindowManager();
            this._db = new ConnectionToDBModel(_eventAggregator);
            GUIstringsModel strings = new GUIstringsModel();

            this._eventAggregator.Subscribe(this);

            this.MainWindowTitle         = strings.GetGUIstr("MainWindowTitle");
            this.MenuButtonTests         = strings.GetGUIstr("MenuButtonTests");
            this.MenuButtonTests_Learn   = strings.GetGUIstr("MenuButtonTests_Learn");
            this.MenuButtonTests_Quiz    = strings.GetGUIstr("MenuButtonTests_Quiz");
            this.MenuButtonEdit          = strings.GetGUIstr("MenuButtonEdit");
            this.MenuButtonEdit_Question = strings.GetGUIstr("MenuButtonEdit_Question");
            this.MenuButtonEdit_Test     = strings.GetGUIstr("MenuButtonEdit_Test");
            this.MenuButtonOther         = strings.GetGUIstr("MenuButtonOther");
            this.MenuButtonAbout         = strings.GetGUIstr("MenuButtonAbout");

            ActivateItem(new AboutViewModel());
        }
Exemplo n.º 8
0
        public EditTestViewModel(IWindowManager windowManager, EventAggregator eventAggregator, ConnectionToDBModel db)
        {
            this._windowManager   = windowManager;
            this._eventAggregator = eventAggregator;

            this.Db = db;
            Task.Run(() =>
            {
                this.Tests = this.Db.GetTests();
                this.Refresh();
            });

            GUIstringsModel strings = new GUIstringsModel();

            this.AvailableTestsLabel = strings.GetGUIstr("AvailableTestsLabel");
            this.EditTestButton      = strings.GetGUIstr("EditTestButton");
            this.DeleteTestButton    = strings.GetGUIstr("DeleteTestButton");
            this.CreateTestButton    = strings.GetGUIstr("CreateTestButton");

            this.EditTestButtonIsEnabled   = "False";
            this.DeleteTestButtonIsEnabled = "False";
        }
Exemplo n.º 9
0
        public QuizPopUpViewModel(TestModel selectedTest, int allQuestionNumber, float percentToPass, int time)
        {
            GUIstringsModel strings = new GUIstringsModel();

            this.QuizWindowTitle        = strings.GetGUIstr("QuizWindowTitle");
            this.QuestionLabel          = strings.GetGUIstr("QuestionLabel");
            this.PreviousQuestionButton = strings.GetGUIstr("PreviousQuestionButton");
            this.NextQuestionButton     = strings.GetGUIstr("NextQuestionButton");
            this.EndQuizButton          = strings.GetGUIstr("EndQuizButton");
            this.TimeLeftLabel          = strings.GetGUIstr("TimeLeftLabel");
            this.MessageBoxResult       = strings.GetGUIstr("MessageBoxResult");
            this.MessageBoxYourResultIs = strings.GetGUIstr("MessageBoxYourResultIs");
            this.MessageBoxQuizPassed   = strings.GetGUIstr("MessageBoxQuizPassed");
            this.MessageBoxQuizFailed   = strings.GetGUIstr("MessageBoxQuizFailed");

            this.Time          = time;
            this.PercentToPass = percentToPass;
            this.QuizMechanism = new TestForQuizModel(selectedTest, allQuestionNumber);
            this.PreviousQuestionButtonIsEnabled = "False";
            if (this.QuizMechanism.CurrentQuestionNumber < this.QuizMechanism.AllQuestionNumber)
            {
                this.NextQuestionButtonIsEnabled = "True";
            }
            else
            {
                this.NextQuestionButtonIsEnabled = "False";
            }
            this.EndQuizButtonIsEnabled = "True";

            this.Timer = new DispatcherTimer
            {
                Interval = TimeSpan.FromSeconds(1)
            };
            Timer.Tick        += new EventHandler(TimerTick);
            this.TimeLeftValue = this.Time.ToString();
            this.Timer.Start();
        }
Exemplo n.º 10
0
        public AboutViewModel()
        {
            GUIstringsModel strings = new GUIstringsModel();

            this.About = strings.GetGUIstr("About");
        }