public async void SaveSearchTerm(string SearchTerm) { var file = await ApplicationData.Current.LocalFolder.GetFileAsync("settings.xml"); var doc = await Windows.Data.Xml.Dom.XmlDocument.LoadFromFileAsync(file); var elementHistory = doc.GetElementsByTagName("history"); Windows.Data.Xml.Dom.XmlElement elem = doc.CreateElement("searchedterm"); Windows.Data.Xml.Dom.XmlText text = doc.CreateTextNode(SearchTerm); elementHistory[0].AppendChild(elem); elementHistory[0].LastChild.AppendChild(text); await doc.SaveToFileAsync(file); }
public void ExportSvg(StorageFolder outputFolder) { if (TableRecords == null || outputFolder == null) { return; } // Export each SVG glyph by iterating over the table records. int numExportedSvgs = 0; foreach (TableRecord record in TableRecords) { if (record.tag == "SVG ") { numExportedSvgs = parser.ExportSvgContent(record, source, outputFolder); } } // Show toast with number of successful SVG files saved. if (numExportedSvgs > 0) { // Make the toast. ToastTemplateType toastTemplate = ToastTemplateType.ToastText01; Windows.Data.Xml.Dom.XmlDocument xml = ToastNotificationManager.GetTemplateContent(toastTemplate); xml.DocumentElement.SetAttribute("launch", "Args"); // Set up the toast text. string toastString = numExportedSvgs + " SVGs were successfully saved to " + outputFolder.Path; Windows.Data.Xml.Dom.XmlText toastText = xml.CreateTextNode(toastString); Windows.Data.Xml.Dom.XmlNodeList elements = xml.GetElementsByTagName("text"); elements[0].AppendChild(toastText); // Show the toast. ToastNotification toast = new ToastNotification(xml); ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier(); toastNotifier.Show(toast); } }