/// <summary> /// Saves the context results to the the application /// isolated storage area. /// </summary> /// <param name="sender">The event source.</param> /// <param name="e">The event arguments.</param> private void OnSaveResultsButtonClick(object sender, EventArgs e) { // for storing results it will be used recursively TestResultPlainData resultsData = CollectContextResults(true); string folderName = "TestResults"; string fileName = resultsData.FileName; // File is going to be stored on the root folder of the app using (IsolatedStorageFile testStore = IsolatedStorageFile.GetUserStoreForApplication()) { // Check if test results folder exists or create it if (!testStore.DirectoryExists(folderName)) { testStore.CreateDirectory(folderName); } // indicates the name of the file to be used, every time a new test // is stored, the results file is replaced. using (IsolatedStorageFileStream testFileStream = new IsolatedStorageFileStream(System.IO.Path.Combine(folderName, fileName), FileMode.Create, testStore)) { using (StreamWriter testFileWriter = new StreamWriter(testFileStream)) { testFileWriter.Write(resultsData.Text); MessageBox.Show(String.Format("A text file with the test results has been created.\nUse the Isolated Storage Explorer to extract the files from the device or Emulator.\n\nFile Name: {0}", fileName), "Save Process Completed", MessageBoxButton.OK); } } } }
/// <summary> /// Fires the Email Task to send context results to the designated email /// address. /// </summary> /// <param name="sender">The event source.</param> /// <param name="e">The event arguments.</param> private void OnEmailResultsButtonClick(object sender, EventArgs e) { // For results email only the current results view is send. TestResultPlainData resultsData = CollectContextResults(false); EmailComposeTask ect = new EmailComposeTask(); ect.Subject = "[WPUTFx] Test Results"; ect.Body = resultsData.Text; ect.Show(); }