private void SignUp_Click(object sender, RoutedEventArgs e) { BdClassGet bdClassGet = new BdClassGet(); BdClassAdd bdClassAdd = new BdClassAdd(); List <string> EMail = new List <string>(); bdClassGet.GetAllUsers(EMail); bool coincidences = EMail.Any(n => n == Mail.Text); if (coincidences) { MessageBox.Show("Such a user exists"); Mail.Text = ""; Name.Text = ""; Pass.Password = ""; } else { bdClassAdd.AddUser(EMail.Count + 1, Mail.Text, Name.Text, Pass.Password); MessageBox.Show("Registration was successful"); User.Name = Name.Text; EventOpenSettings?.Invoke(new SettingsPage()); EventOpenSettings += MainWindow.EventClickGrid; EventOpenSettings(new SettingsPage()); Close(); } }
private void SignUp_Click(object sender, RoutedEventArgs e) { var services = new ServiceCollection(); services.AddAudioBypass(); var api = new VkApi(services); try { api.Authorize(new ApiAuthParams { ApplicationId = 123456, Login = TelephoneOrMail.Text, Password = Pass.Password }); var account = api.Account.GetProfileInfo(); BdClassGet bdClassGet = new BdClassGet(); List <string> Mail = new List <string>(); bdClassGet.GetAllUsers(Mail: Mail); int count = 0; foreach (var item in Mail) { if (item == account.FirstName + "VK") { count++; } } if (count == 0) { BdClassAdd bdClassAdd = new BdClassAdd(); bdClassAdd.AddUser(1, account.FirstName + "VK", "VK", "VK"); User.Name = account.FirstName + "VK"; EventOpenSettings?.Invoke(new SettingsPage()); EventOpenSettings += MainWindow.EventClickGrid; EventOpenSettings(new SettingsPage()); } else { if (bdClassGet.auth(account.FirstName + "VK", "VK")) { User.Name = account.FirstName + "VK"; EventOpenSettings?.Invoke(new SettingsPage()); EventOpenSettings += MainWindow.EventClickGrid; EventOpenSettings(new SettingsPage()); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Close(); } }
private void SignInButton_Click(object sender, RoutedEventArgs e) { BdClassGet bdClass = new BdClassGet(); if (bdClass.auth(Email.Text, UserPassword.Password)) { User.Name = Email.Text; EventOpenSettings?.Invoke(new SettingsPage()); EventOpenSettings += MainWindow.EventClickGrid; EventOpenSettings(new SettingsPage()); } }
private void MainSignInForm_Loaded(object sender, RoutedEventArgs e) { EventOpenSettings?.Invoke(new SettingsPage()); EventOpenSettings += MainWindow.OpenFilm; EventOpenSettings(new SettingsPage()); }