示例#1
0
 internal static void AddStore(string documenPath, StoreViewModel store)
 {
     var root = XDocument.Load(documenPath).Root;
     root.Add(new XElement("store",
         new XElement("name", store.Name),
         new XElement("phones", null)));
     root.Document.Save(documenPath);
 }
示例#2
0
 internal static void RemoveStore(string documenPath, StoreViewModel store)
 {
     var root = XDocument.Load(documenPath).Root;
     foreach (var storeChild in root.Elements("store"))
     {
         if (storeChild.Element("name").Value.ToLower()==store.Name.ToLower())
         {
             storeChild.Remove();
             root.Document.Save(documenPath);
             break;
         }
     }
 }
 public StoresViewModel()
 {
     this.StoresDocumentPath = "..\\..\\phones.xml";
     this.newStoreViewModel = new StoreViewModel();
 }