示例#1
0
 private void Registrieren(object obj)
 {
     if (Passwort.Equals(Passwortconfirm))
     {
         new ClientModel(Username, Passwort);
     }
     MessageBox.Show("Passwort stimmen nicht Überein");
 }
示例#2
0
        public void SchreibeXML()
        {
            try
            {
                // Erzeugt ein neues XMLDocument
                XmlDocument doc = new XmlDocument();

                // Fügt den Wurzelknoten "Config" zum XMLDocument hinzu
                XmlNode rootNode = doc.CreateElement("Config");
                doc.AppendChild(rootNode);

                // Erzeugt einen Knoten mit dem Tag "Allgemein"
                XmlNode childNodeAllg = doc.CreateElement("Allgemein");
                // Fügt die Eigenschaft Stundensoll dem Knoten hinzu
                XmlAttribute stundenSoll = doc.CreateAttribute("Stundensoll");
                stundenSoll.Value = StundenSoll.ToString();
                childNodeAllg.Attributes.Append(stundenSoll);
                // Fügt die Eigenschaft StandardZielPfad dem Knoten hinzu
                XmlAttribute standardZielPfad = doc.CreateAttribute("StandardZielPfad");
                standardZielPfad.Value = StandardZielPfad.ToString();
                childNodeAllg.Attributes.Append(standardZielPfad);
                // Fügt den Knoten dem XMLDocument hinzu
                rootNode.AppendChild(childNodeAllg);

                // Erzeugt einen Knoten mit dem Tag "Datenbank"
                XmlNode childNodeDB = doc.CreateElement("Datenbank");
                // Fügt die Eigenschaft WinAuth dem Knoten hinzu
                XmlAttribute winAuth = doc.CreateAttribute("WinAuth");
                winAuth.Value = WinAuth.ToString();
                childNodeDB.Attributes.Append(winAuth);
                // Fügt die Eigenschaft Datenbank dem Knoten hinzu
                XmlAttribute datenbank = doc.CreateAttribute("Datenbank");
                datenbank.Value = Datenbank.ToString();
                childNodeDB.Attributes.Append(datenbank);
                // Fügt die Eigenschaft Server dem Knoten hinzu
                XmlAttribute server = doc.CreateAttribute("Server");
                server.Value = Server.ToString();
                childNodeDB.Attributes.Append(server);
                // Fügt die Eigenschaft BenutzerName dem Knoten hinzu
                XmlAttribute benutzerName = doc.CreateAttribute("BenutzerName");
                benutzerName.Value = BenutzerName.ToString();
                childNodeDB.Attributes.Append(benutzerName);
                // Fügt die Eigenschaft Passwort dem Knoten hinzu
                XmlAttribute passwort = doc.CreateAttribute("Passwort");
                passwort.Value = Passwort.ToString();
                childNodeDB.Attributes.Append(passwort);
                // Fügt den Knoten dem XMLDocument hinzu
                rootNode.AppendChild(childNodeDB);

                // Schreibt das XmlDocument in die Datei in %Appdata%
                string path = GetFolderPath(SpecialFolder.ApplicationData);
                path = Path.Combine(path, "easyAuftrag");
                path = Path.Combine(path, "Config");
                Directory.CreateDirectory(path);
                path = Path.Combine(path, "config.xml");
                doc.Save(path);
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorHandle(ex);
            }
        }