/// <summary> /// Constructor /// </summary> /// <param name="user">User to add/edit</param> /// <param name="isNew">Is user new?</param> public UserEditForm(User user, bool isNew) { InitializeComponent(); this.currentUser = user; this.isUserNew = isNew; }
/// <summary> /// Shows <see cref="Karafa.GUI.UserEditForm"/> to add/edit user. /// </summary> /// <param name="user">User to add/edit</param> /// <param name="isNew">True for add new user, false to edit user</param> private void ShowEditUserForm(User user, bool isNew) { UserEditForm form = new UserEditForm(user, isNew); form.Owner = this; form.btn_Save.Click += new RoutedEventHandler( delegate { // Add new user to data grid if (form.IsUserSaved && isNew) { this.users.Add(user); this.dg_Users.ItemsSource = ""; this.dg_Users.ItemsSource = users; } userListSaved = false; } ); form.LoadData(); form.Show(); }
/// <summary> /// Shows <see cref="Karafa.GUI.UserEditForm"/> to add user /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnBtnAddUser_Click(object sender, RoutedEventArgs e) { User user = new User(); ShowEditUserForm(user, true); }