//METHODS: //constructor from preferences file public Preferences() { preferenceList = new List<Preference>(); preferenceDoc = new XmlDocument(); preferenceDoc.Load(xmlFilename); XmlNodeList services = preferenceDoc.GetElementsByTagName("webservice"); foreach(XmlNode service in services) { Preference newPref = new Preference((XmlElement)service); preferenceList.Add(newPref); } }
public void AddPreference(Preference preference) { foreach (Preference preference_ in preferenceList) { if (preference_.ServiceName == preference.ServiceName) { throw new Exception("That preference already exists!"); } } preferenceList.Add(preference); //create xml for the preference and write to disk XmlElement newElement = preference.getXmlPreference(preferenceDoc); preferenceDoc.Save(xmlFilename); }
public void AddPreference(string serviceName, settings setting) { Preference preference = new Preference(serviceName, setting); AddPreference(preference); }