private void btnSignIn_Click(object sender, RoutedEventArgs e) { //Porovnat meno so ziskanymi menami zo suboru //Ak sa meno nachadza v subore, tak porovnat hesla //Ak je heslo rovnake ako to zo suboru, tak prepnut okno na ProjectsWindow insertedName = txtNickName.Text; insertedPass = txtPasswordA.Text; XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(pathToXmlFile); XmlNodeList nodes = xmldoc.SelectNodes("users/user/name"); XmlNodeList passNodes = xmldoc.SelectNodes("users/user/pass"); XmlDataHandler xmlDataHandler = new XmlDataHandler(nodes, insertedName, passNodes, insertedPass); whatFound = xmlDataHandler.ReadNameAndPass(); if (!(whatFound.Equals("NAME_OK") || whatFound.Equals("NAME_OKPASS_OK"))) { MessageBox.Show("Inserted name does not exist"); } else if (whatFound.Equals("NAME_OK")) { MessageBox.Show("Inserted password was incorrect"); } else { //Ak je heslo rovnake ako to zo suboru, tak prepnut okno na ProjectsWindow ProjectsWindow projectsWindow = new ProjectsWindow(); projectsWindow.Show(); this.Close(); } }
private void btnBackToMenu_Click(object sender, RoutedEventArgs e) { ProjectsWindow projectsWindow = new ProjectsWindow(); projectsWindow.Show(); this.Close(); }
private void btnNewProject_Click(object sender, RoutedEventArgs e) { string[] txtBoxesContent = new string[3]; txtBoxesContent[0] = txtNickName.Text; txtBoxesContent[1] = txtAbbreviation.Text; txtBoxesContent[2] = txtCustomer.Text; XmlDataHandler xdh = new XmlDataHandler(txtBoxesContent); xdh.PathToXmlFile = pathToXmlFile; xdh.AddToProject(); MessageBox.Show("New values successfully saved"); ProjectsWindow projectsWindow = new ProjectsWindow(); projectsWindow.Show(); this.Close(); }
private void btnEditProject_Click(object sender, RoutedEventArgs e) { //Read values in textboxes and insert them to selected node XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(pathToXmlFile); XmlNodeList nodes = xmldoc.SelectNodes("projects/project/name"); foreach (XmlNode node in nodes) { if (node.InnerText.Equals(nameOfProject)) { node.InnerText = txtNickName.Text; node.NextSibling.InnerText = txtAbbreviation.Text; node.NextSibling.NextSibling.InnerText = txtCustomer.Text; xmldoc.Save(pathToXmlFile); MessageBox.Show("New values successfully saved"); ProjectsWindow projectsWindow = new ProjectsWindow(); projectsWindow.Show(); this.Close(); } } }