Пример #1
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Frame.BackStack.RemoveAt(Frame.BackStackDepth - 1);
            Apps app = AppInstance.app;

            if (app.Type.Contains("Spellings"))
            {
                puzzle               = SpellingsModel.getInstance();
                ScoreText.Text       = "You have completed the Spellings Puzzle: " + puzzle.getPuzzleName();
                TotalCorrect.Text    = "Total Correct: " + puzzle.getTotalCorrect();
                TotalWrong.Text      = "Total Wrong: " + puzzle.getTotalWrong();
                TotalUnanswered.Text = "Total Unanswered: " + (puzzle.getSpellingsList().Count - (puzzle.getTotalWrong() + puzzle.getTotalCorrect()));
                SpellingsModel.clearInstance();
            }
            else if (app.Type.Contains("Quiz"))
            {
                quiz                 = QuizModel.getInstance();
                ScoreText.Text       = "You have completed the Quiz: " + quiz.getQuizName();
                TotalCorrect.Text    = "Total Correct: " + quiz.getTotalCorrect();
                TotalWrong.Text      = "Total Wrong: " + quiz.getTotalWrong();
                TotalUnanswered.Text = "Total Unanswered: " + (quiz.getQueAnsList().Count - (quiz.getTotalWrong() + quiz.getTotalCorrect()));
                QuizModel.clearInstance();
            }
            this.navigationHelper.OnNavigatedTo(e);
        }
Пример #2
0
 /// <summary>
 /// It reads the Spellings-Puzzle App-Template, from the .buildmlearn file.
 /// </summary>
 /// <param name="fileName">Name of the file</param>
 public static void readSpellingsFile(string fileName)
 {
     try
     {
         SpellingsModel   model    = SpellingsModel.getInstance();
         List <WordModel> wordList = new List <WordModel>();
         XmlDocument      doc      = new XmlDocument();
         doc.LoadXml(XDocument.Load("Assets/Apps/" + fileName + ".xml").ToString());
         model.setPuzzleName(doc.GetElementsByTagName("title").ElementAt(0).InnerText.Trim());
         model.setPuzzleDescription(doc.GetElementsByTagName("description").ElementAt(0).InnerText.Trim());
         string[] author = doc.GetElementsByTagName("author").ElementAt(0).InnerText.Split('\n');
         model.setPuzzleAuthor(author[1].Trim());
         model.setPuzzleAuthorEmail(author[2].Trim());
         model.setPuzzleVersion(doc.GetElementsByTagName("version").ElementAt(0).InnerText.Trim());
         XmlNodeList item = doc.GetElementsByTagName("item");
         // looping through all item nodes <app>
         for (int i = 0; i < item.Length; i++)
         {
             string[]  ar   = item.ElementAt(i).InnerText.Split('\n');
             WordModel word = new WordModel(ar[1].Trim(), ar[2].Trim());
             wordList.Add(word);
         }
         model.setSpellingsList(wordList);
     }
     catch (Exception) { }
 }