//Деавторизация private void ButtonLog_Out_Click(object sender, RoutedEventArgs e) { Accept = false; xDocumentPassword.Element("PassWords").Attribute("Accept").Value = false.ToString(); PasswordXML.SaveXMLPassword(xDocumentPassword); MessageBox.Show("Операция успешна."); }
//Диалоговое окно авторизации private void buttonLog_In_Click(object sender, RoutedEventArgs e) { PassWordWindow passWordWindow = new PassWordWindow(); if (passWordWindow.ShowDialog() == true) { if (MethodLog_In(passWordWindow.Login, passWordWindow.PassWord)) { MessageBox.Show("Авторизация успшешна"); Accept = true; xDocumentPassword.Element("PassWords").Attribute("Accept").Value = true.ToString(); PasswordXML.SaveXMLPassword(xDocumentPassword); } else { MessageBox.Show("Неверный логин и/или пароль"); } } else { MessageBox.Show("Авторизация не пройдена"); } }
//Метод регестрации private static bool Regestration(string first_name, string second_name, string login, string password) { var result = from data in xDocumentPassword.Element("PassWords").Elements("Account") select new { Login = data.Element("Login").Value, Password = data.Element("PassWord").Value, Name = data.Element("First_Name").Value, Second_Name = data.Element("Second_Name").Value }; foreach (var item in result) { if (item.Login == login) { return(false); } } var tempXElementNewAccount = PasswordXML.SetXElement(first_name, second_name, login, password); xDocumentPassword.Element("PassWords").Add(tempXElementNewAccount); xDocumentPassword.Save("parkingDatePassword.xml"); return(true); }
public Page1() { InitializeComponent(); xDocumentPassword = PasswordXML.GetXDocument(); Accept = bool.Parse(xDocumentPassword.Element("PassWords").Attribute("Accept").Value); }