Exemplo n.º 1
0
 //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);
     }
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 public void AddPreference(string serviceName, settings setting)
 {
     Preference preference = new Preference(serviceName, setting);
     AddPreference(preference);
 }