private void saveAll() { int incomplete = 0; foreach (Landmark l in map.getLandmarks()) { if (l.Type == null) { incomplete++; } } if (incomplete > 0) { MessageBox.Show( "You have some landmarks which do not have valid landmark type. \nPlease check your landmarks again.", "Landmark type error", MessageBoxButton.OK, MessageBoxImage.Error); if (llw == null) { llw = new LandmarkListWindow(this, map); } llw.Show(); } else { currentUser.setUserMap(map); LoginModel.updateUser(currentUser); UserFileManipulation.saveUsers(LoginModel.Users); notSaved = false; MessageBox.Show("All data saved.", "Save", MessageBoxButton.OK, MessageBoxImage.Information); } }
public LoginModel() { Users = UserFileManipulation.loadUsers(); if (Users == null) { Users = new Dictionary <string, User>(); } }
public User addUser(String email, String username, String password) { if (Users.ContainsKey(username)) { return(null); } User u = new User(email, username, password); Users.Add(username, u); UserFileManipulation.saveUsers(Users); return(u); }