예제 #1
0
        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 btnZmazProjekt_Click(object sender, RoutedEventArgs e)
 {
     //Vymazat cely node z Xml suboru podla vybraneho projektu v listBoxe
     if (lboxZoznamProjektov.SelectedItem != null)
     {
         XmlDataHandler xmlDataHandler = new XmlDataHandler(pathToXmlFile, lboxZoznamProjektov.SelectedItem.ToString());
         xmlDataHandler.DeleteElement();
     }
     else
     {
         MessageBox.Show("Select one project");
     }
     //Vycistit listBox a natiahnut zoznam nanovo
     FillListBox();
 }
예제 #3
0
        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();
        }