Advertisement
Guest User

Untitled

a guest
Apr 1st, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. private void AAbutton1_Click(object sender, RoutedEventArgs e)
  2. {
  3.  
  4. Account selected = new Account();
  5. if (textBox2.Text != null)
  6. selected.username = textBox2.Text;
  7. if (textBox12.Text != null)
  8. selected.password = textBox12.Text;
  9. if (locationTxtBox2.Text != null)
  10. selected.location = locationTxtBox2.Text;
  11. MainWindow.Instance.editAccount(selected);
  12. MainWindow.Instance.updateData();
  13. MainWindow.Instance.needsSave = true;
  14. }
  15.  
  16. public void editAccount(Account acc)
  17. {
  18. Account acc2;
  19. Account selected = (Account)dataGrid.SelectedItem;
  20. acc2 = Manager.accounts.ElementAt(Manager.accounts.FindIndex(a=> a == selected));
  21. acc2.username = acc.username;
  22. acc2.password = acc.password;
  23. acc2.location = acc.location;
  24. }
  25.  
  26. public class Account
  27. {
  28. public String username { get; set; }
  29. public String password { get; set; }
  30. public String location { get; set; }
  31. public Account(String username,String password, String location)
  32. {
  33. this.username = username;
  34. this.password = password;
  35. this.location = location;
  36. }
  37. public Account()
  38. {
  39.  
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement