private async void SubmitApplicationBarIconButton_OnClick(object sender, EventArgs e) { if (placeIndex < 2) { StaticData.CurrentErrollments.CompletedPlace = placeIndex + 1; try { await UserAPI.AnswerScalingQuestionTask(ScalingSlider.Value.ToString(), StaticData.CurrentUser.Id.ToString(), StaticData.CurrentErrollments.Places[placeIndex].Id.ToString(), this); } catch (Exception exception) { Console.WriteLine(exception); } } else { try { await UserAPI.AnswerOpenEndedQuestionTask(MainTextBox.Text, StaticData.CurrentUser.Id.ToString(), StaticData.CurrentErrollments.Places[placeIndex].Id.ToString(), this); } catch (Exception exception) { Console.WriteLine(exception); } } XmlWriterSettings xmlWriterSettings = new XmlWriterSettings(); xmlWriterSettings.Indent = true; using (IsolatedStorageFile isoStorage = IsolatedStorageFile.GetUserStoreForApplication()) { //Create a file stream to open or create file using ( IsolatedStorageFileStream stream = new IsolatedStorageFileStream("EnrollmentHistory.xml", FileMode.OpenOrCreate, isoStorage)) { XmlSerializer serializer = new XmlSerializer(StaticData.ErrollmentHistory.GetType()); using (XmlWriter xmlWriter = XmlWriter.Create(stream, xmlWriterSettings)) { // Viết dữ liệu theo Serialize serializer.Serialize(xmlWriter, StaticData.ErrollmentHistory); } } } if (placeIndex == 2) { //Last diamond collected NavigationService.RemoveBackEntry(); NavigationService.RemoveBackEntry(); NavigationService.Navigate(new Uri("/PageGroups/QuestionGroup/GiftCodePage.xaml", UriKind.Relative)); } else { NavigationService.RemoveBackEntry(); NavigationService.GoBack(); } }