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); } }
private void LandmarkList_OnClick(object sender, RoutedEventArgs e) { if (llw == null) { llw = new LandmarkListWindow(this, currentUser.getUserMap()); llw.Show(); } else { llw.Topmost = true; // important llw.Topmost = false; // important llw.Focus(); // important } }