/// <summary> /// The main method /// </summary> /// <param name="itemId">We take it from MainPage - it's file's name</param> private void IAmNavigted(string filePath) { if (filePath[7] == '3') { testInfo = new TestInfo(filePath, true); task.IsEnabled = true; TestWithTimer(); } else { testInfo = new TestInfo(filePath, false); task.Visibility = Windows.UI.Xaml.Visibility.Collapsed; task.IsEnabled = false; Test(); } }
/// <summary> /// The main method /// </summary> /// <param name="itemId">We take it from MainPage - it's file's name</param> private void IAmNavigted(string filePath) { if (filePath[7] == '3') { testInfo = new TestInfo(filePath, true); task.IsEnabled = true; TestWithTimer(); } else { testInfo = new TestInfo(filePath, false); task.Visibility = Windows.UI.Xaml.Visibility.Collapsed; task.IsEnabled = false; Test(); } pageTitle.Text = testInfo.xDoc.Root.Attribute("name").Value; }
private void CreateGraph(TestInfo testInfo) { try { //gets info from Tag and opens the file List<Graph> gList = new List<Graph>(); gList.Add(new Graph() { Title = "Ваш результат", Result = Convert.ToInt32(testInfo.result) }); string descXML = ""; string nameXML = testInfo.xDoc.Element("head").Attribute("name").Value; string maxXML = testInfo.xDoc.Element("head").Attribute("max").Value; gList.Add(new Graph() { Title = "Осталось", Result = Convert.ToInt32(maxXML) - Convert.ToInt32(testInfo.result) }); var results = testInfo.xDoc.Root.Element("end").Elements(); foreach (XElement elem in results) { if((int)testInfo.result >= Convert.ToInt32(elem.Attribute("min").Value)) { descXML = elem.Value; tbRes.Text = testInfo.result.ToString() + " балл(а, ов). \n\n" + descXML; break; } } //put info into the Chat (Charty.Series[0] as PieSeries).ItemsSource = gList; //info about result goes to the result-file xmlRedactor(nameXML, maxXML, testInfo.result.ToString(), descXML); //2nd and 3rd groups descBlock.Text += "ОТВЕТЫ: \n\n\n"; int i = 1; if (testInfo.path[7] == '3') foreach (var elem in testInfo.xDoc.Root.Elements("question")) { descBlock.Text += String.Format("{0}) {1}\nПРАВИЛЬНЫЙ ОТВЕТ: {2}\nВЫ ОТВЕТИЛИ: {3}\n\n", i, elem.Attribute("name").Value, elem.Attribute("ans").Value, testInfo.myAnswers[i - 1]); i++; } else if (testInfo.path[7] == '2') foreach (var elem in testInfo.xDoc.Root.Elements("question")) { descBlock.Text += String.Format("{0}) {1}\nПРАВИЛЬНЫЙ ОТВЕТ: {2}\nВЫ ОТВЕТИЛИ: {3}\n\n", i, elem.Attribute("name").Value, elem.Elements().Where(el => el.Attribute("value").Value == "1").First().Attribute("means").Value, testInfo.myAnswers[i - 1]); i++; } else ChangeTextBtn.Visibility = Windows.UI.Xaml.Visibility.Collapsed; //if user wants to retry Again.Tag = testInfo.path; } catch (System.FormatException) { Mess("Произошла ошибка при построении графика."); } }