private void SavePackages() { //The user is influenced to believe a Save event will only //save the ActivePackage but really it will save all of them. //Code is in place to prevent the user from editing one package then //trying to load another without saving the first. //At this point the XmlRootData object is stale and needs to be //repopulated with the Packages collection. XmlPackageData.Descendants("Package").Remove(); //But the ActivePackage may have its Web Resources modified and they //need to be added back to the ActivePackage. if (ActivePackage != null) { ActivePackage.Elements("WebResourceInfo").Remove(); ActivePackage.Add(WebResourceInfos.ToArray()); } XmlPackageData.Element("Packages").Add(Packages.ToArray()); XmlPackageData.Save(PACKAGES_FILENAME); IsActivePackageDirty = false; }
private void LoadWebResourceInfos() { if (ActivePackage == null) { return; } //As always, clear the collection first. WebResourceInfos.Clear(); WebResourceInfosSelected.Clear(); var webResourceInfos = ActivePackage.Elements("WebResourceInfo"); if (webResourceInfos != null) { foreach (var wr in webResourceInfos) { WebResourceInfos.Add(wr); } } }