예제 #1
0
        private void DeleteUser_Click(object sender, RoutedEventArgs e)
        {
            bool valide = false;

            if (!File.Exists(MainWindow.users_path + txtbox_userLogin.Text))
            {
                ShowMsg("Deleting user error", "User not found");
            }
            else if (txtbox_userLogin.Text != "LastUserID")
            {
                valide = true;
            }
            if (valide)
            {
                List <string> emails = new List <string>();
                using (var reader = new StreamReader("emails/emails"))
                {
                    while (!reader.EndOfStream)
                    {
                        emails.Add(reader.ReadLine());
                    }
                }
                Users.User user_for_delete = new Users.User();
                user_for_delete.Deserialize(MainWindow.users_path + txtbox_userLogin.Text);
                emails.Remove(user_for_delete.Email);
                using (var writer = new StreamWriter("emails/emails"))
                {
                    foreach (var email in emails)
                    {
                        writer.WriteLine(email.ToString());
                    }
                }
                File.Delete(MainWindow.users_path + user_for_delete.Login);
                ShowMsg("Deleting user", "User deleted successfully");
                Close();
            }
        }
예제 #2
0
 public ChangeEmailForm(Users.User user, Panel panel)
 {
     InitializeComponent();
     this.user = user;
     Desktop   = panel;
 }