private async void DisplayAdvancedSettings()
        {
            // Fetches some potentially expansive data now.
            LicensingManager licensingManager = App.Current.ViewModel.LicensingManager;

            CustomSupportStatus = "Custom Support IAP: "
                                  + (await licensingManager.ValidateCustomSupportLicense() ? "Yes" : "No")
                                  + (licensingManager.HasCustomSupportCertificate ? ", Installed" : "");

            // Displays!
            AreAdvancedSettingsDisplayed = true;
        }
        private async void SendBugReport()
        {
            // Requests a report flush.
            if (ReportFormFlushRequested != null)
            {
                ReportFormFlushRequested(this, EventArgs.Empty);
            }

            // Gets the licensing manager.
            LicensingManager licensingManager = App.Current.ViewModel.LicensingManager;

            // Bakes the report.
            DebugUtils.BugReport report = DebugUtils.MakeDebugReport();

            // Maintains local storage copies of the report, so that the latest generated, non-null
            // report is in "report.txt" and the previous "report.txt" is saved as "report.old.txt".
            string filenameNewReport = "report.txt";
            string filenameOldReport = "report.old.txt";
            bool   hasNewReport      = false;
            bool   hasOldReport      = false;

            using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
            {
                // Determines what file operations to perform.
                bool newReportExists     = isf.FileExists(filenameNewReport);
                bool shouldWriteReport   = report.FileCount > 0 || !newReportExists;
                bool shouldSaveOldReport = newReportExists && shouldWriteReport;

                // Saves the old report if needed.
                if (shouldSaveOldReport)
                {
                    try
                    {
                        isf.CopyFile(filenameNewReport, filenameOldReport, true);
                    }
                    catch (Exception)
                    {
                        // Nothing to do, too bad.
                    }
                }
                hasOldReport = isf.FileExists(filenameOldReport);

                // Writes the new report.
                if (shouldWriteReport)
                {
                    try
                    {
                        using (IsolatedStorageFileStream fs = isf.OpenFile(filenameNewReport, System.IO.FileMode.Create))
                        {
                            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(fs))
                            {
                                sw.WriteLine(report.Report);
                            }
                        }
                    }
                    catch (Exception)
                    {
                        // This is really bad. Let the user know.
                        MessageBox.Show("An error occured during the collection of helpful data. Without this, your problem may be harder to solve. Please make sure to describe your problem the best you can in the e-mail that is about to be sent.", "Warning", MessageBoxButton.OK);
                    }
                }
                hasNewReport = isf.FileExists(filenameNewReport);
            }

            // Gets the report files.
            StorageFolder localFolder   = ApplicationData.Current.LocalFolder;
            StorageFile   newReportFile = hasNewReport ? await localFolder.GetFileAsync(filenameNewReport) : null;

            StorageFile oldReportFile = hasOldReport ? await localFolder.GetFileAsync(filenameOldReport) : null;

            StorageFile customSupportFile = licensingManager.HasCustomSupportCertificate ? await localFolder.GetFileAsync(LicensingManager.CustomSupportLicenseFilepath) : null;

            // Makes the body of the e-mail.
            StringBuilder bodySb = new StringBuilder();

            bodySb.AppendLine("An error report is attached with this e-mail.");
            bodySb.AppendLine("");
            if (ReportProblemListSelectedIndex >= 0)
            {
                bodySb.AppendLine("Problem: " + ReportProblemListItemSource[ReportProblemListSelectedIndex]);
            }
            if (ReportLocationListSelectedIndex >= 0)
            {
                bodySb.AppendLine("Where: " + ReportLocationListItemSource[ReportLocationListSelectedIndex]);
            }
            if (IsAppSupporterContentVisible)
            {
                bodySb.AppendLine("Custom support enabled for user.");
            }
            bodySb.AppendLine("Additional notes:");
            bodySb.AppendLine(ReportExtraNotes);
            bodySb.AppendLine();

            // Makes an e-mail.
            EmailMessage email = new EmailMessage()
            {
                Subject = "Geowigo Bug Report",
                Body    = bodySb.ToString()
            };

            email.To.Add(new EmailRecipient("*****@*****.**"));
            if (newReportFile != null)
            {
                email.Attachments.Add(new EmailAttachment(filenameNewReport, RandomAccessStreamReference.CreateFromFile(newReportFile)));
            }
            if (oldReportFile != null)
            {
                email.Attachments.Add(new EmailAttachment(filenameOldReport, RandomAccessStreamReference.CreateFromFile(oldReportFile)));
            }
            if (customSupportFile != null)
            {
                email.Attachments.Add(new EmailAttachment(
                                          System.IO.Path.GetFileName(LicensingManager.CustomSupportLicenseFilepath),
                                          RandomAccessStreamReference.CreateFromFile(customSupportFile)));
            }
            // add iap

            // Prompts the user to send the e-mail.
            await EmailManager.ShowComposeNewEmailAsync(email);

            // Clears the debug files.
            DebugUtils.ClearCache();

            // Clears the form and goes back to the menu.
            CancelBugReport();
        }