void b_Click(object sender, RoutedEventArgs e) { Button b = sender as Button; DataRowView dataRowView = b.DataContext as DataRowView; if (dataRowView.IsNew || dataRowView.Row.RowState == DataRowState.Detached || dataRowView.Row.RowState == DataRowState.Added) { MessageBox.Show("du måste spara användaren först"); } else if (dataRowView != null) { object salt = dataRowView.Row.Field <int>("Salt"); if (salt != null) { SetPwWindow win = new SetPwWindow(); win.ShowDialog(); if (win.password != null) { dataRowView.BeginEdit(); byte[] binPw = Common.UserLoginHelper.ComputeHash(win.password, (int)salt); dataRowView[PropertyName] = binPw; dataRowView.EndEdit(); } } } }
void b_Click(object sender, RoutedEventArgs e) { Button b = sender as Button; DataRowView dataRowView = b.DataContext as DataRowView; if (dataRowView.IsNew || dataRowView.Row.RowState == DataRowState.Detached || dataRowView.Row.RowState == DataRowState.Added) { MessageBox.Show("du måste spara användaren först"); } else if (dataRowView != null) { object salt = dataRowView.Row.Field<int>("Salt"); if (salt != null) { SetPwWindow win = new SetPwWindow(); win.ShowDialog(); if (win.password != null) { dataRowView.BeginEdit(); byte[] binPw = Common.UserLoginHelper.ComputeHash(win.password, (int)salt); dataRowView[PropertyName] = binPw; dataRowView.EndEdit(); } } } }