private void QuestionCharacterConnectionRowUpdate(object sender, DataGridRowEditEndingEventArgs e) { if (QuestionCharacterConnectionDataGrid.SelectedItem != null) { QuestionCharacterConnectionDataGrid.RowEditEnding -= QuestionCharacterConnectionRowUpdate; QuestionCharacterConnectionDataGrid.CommitEdit(); QuestionCharacterConnectionDataGrid.RowEditEnding += QuestionCharacterConnectionRowUpdate; } else { return; } var result = new QuestionCharacterConnectionValidation().Validate(e.Row.BindingGroup, CultureInfo.CurrentCulture); if (!result.IsValid) { QuestionCharacterConnectionsSearchBox.IsEnabled = false; return; } QuestionCharacterConnectionsSearchBox.IsEnabled = true; dbContextQuestionCharacterConnection.SaveChanges(); QuestionCharacterConnectionDataGrid.Items.Refresh(); questionCharacterConnectionFlag = false; }
private void QuestionRowUpdate(object sender, DataGridRowEditEndingEventArgs e) { if (QuestionDataGrid.SelectedItem != null) { QuestionDataGrid.RowEditEnding -= QuestionRowUpdate; QuestionDataGrid.CommitEdit(); QuestionDataGrid.RowEditEnding += QuestionRowUpdate; } else { return; } var result = new QuestionValidation().Validate(e.Row.BindingGroup, CultureInfo.CurrentCulture); if (!result.IsValid) { QuestionsSearchBox.IsEnabled = false; return; } QuestionsSearchBox.IsEnabled = true; dbContextQuestion.SaveChanges(); dbContextQuestionCorelation = new AkinatorDatabaseEntities(); dbContextQuestionCorelation.Questions.Load(); dbContextQuestionCorelation.QuestionCorelations.Load(); _questionsListRemote.Source = dbContextQuestionCorelation.Questions.Local; _questionCorelationViewSource.Source = dbContextQuestionCorelation.QuestionCorelations.Local; QuestionCorelationDataGrid.Items.Refresh(); dbContextQuestionCharacterConnection = new AkinatorDatabaseEntities(); dbContextQuestionCharacterConnection.Questions.Load(); dbContextQuestionCharacterConnection.QuestionCharacterConnections.Load(); _conQuestionsListRemote.Source = dbContextQuestionCharacterConnection.Questions.Local; _questionCharacterConnectionViewSource.Source = dbContextQuestionCharacterConnection.QuestionCharacterConnections.Local; QuestionCharacterConnectionDataGrid.Items.Refresh(); QuestionDataGrid.Items.Refresh(); questionFlag = false; }