private void SaveCallback(IAsyncResult asyncResult) { DataServiceResponse response = null; try { response = context.EndSaveChanges(asyncResult); } catch (Exception ex) { gridControl1.BeginInvoke((MethodInvoker) delegate { context.CancelRequest(asyncResult); }); HandleException(ex); gridControl1.BeginInvoke((MethodInvoker) delegate { DetachFailedEntities(); }); } gridControl1.BeginInvoke((MethodInvoker) delegate { wSMS.Reload(); }); gridControl1.BeginInvoke((MethodInvoker) delegate { if (SelectedRow > 0) { gridView1.FocusedRowHandle = SelectedRow; } if (!String.IsNullOrEmpty(newCustomerKey) && gridView1.DataRowCount > OldRowCount) { for (int i = 0; i < gridView1.DataRowCount; i++) { if (newCustomerKey == gridView1.GetRowCellValue(i, gridView1.Columns["CustomerID"]).ToString()) { gridView1.FocusedRowHandle = i; OldRowCount = gridView1.DataRowCount; newCustomerKey = String.Empty; break; } } } }); }
void SaveCallback(IAsyncResult asyncResult) { DataServiceResponse response = null; try { response = context.EndSaveChanges(asyncResult); } catch (Exception ex) { uiDispatcher.BeginInvoke(() => context.CancelRequest(asyncResult)); HandleException(ex); uiDispatcher.BeginInvoke(() => DetachFailedEntities()); } uiDispatcher.BeginInvoke(() => wcfInstantSource.Refresh()); }
private void SaveCallback(IAsyncResult asyncResult) { DataServiceResponse response = null; try { response = context.EndSaveChanges(asyncResult); } catch (Exception ex) { gridControl1.BeginInvoke((MethodInvoker) delegate { context.CancelRequest(asyncResult); }); HandleException(ex); gridControl1.BeginInvoke((MethodInvoker) delegate { DetachFailedEntities(); }); } gridControl1.BeginInvoke((MethodInvoker) delegate { wcfInstantSource.Refresh(); }); }
private void OnSaveChangesCompleted(IAsyncResult result) { // Use the Dispatcher to ensure that the operation returns in the UI thread. this.Dispatcher.BeginInvoke(new OperationResultCallback(delegate { try { // Complete the save changes operation. context.EndSaveChanges(result); } catch (DataServiceRequestException ex) { MessageBox.Show(ex.ToString()); } }), null); }