private void CarBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState != BindingCompleteState.Success) { MessageBox.Show(e.ErrorText); } }
/// <summary> /// Control_BindingComplete() is a event driven routine triggered when one of the control's bindings has been completed. /// Control_BindingComplete() simply validates the result where if the result was a exception then the BindingError /// event is raised, else if the binding was a successful data source update and we are to re-read the value on changed then /// the binding value is reread into the control. /// </summary> /// <param name="sender">The object that triggered the event.</param> /// <param name="e">The event arguments.</param> private void Control_BindingComplete(object sender, BindingCompleteEventArgs e) { switch (e.BindingCompleteState) { case BindingCompleteState.Exception: if ((RefreshOnException) && e.Binding.DataSource is BindingSource && GetReadValuesOnChange((BindingSource)e.Binding.DataSource)) { e.Binding.ReadValue(); } if (BindingError != null) { BindingError(this, new BindingErrorEventArgs(e.Binding, e.Exception)); } break; default: if ((e.BindingCompleteContext == BindingCompleteContext.DataSourceUpdate) && e.Binding.DataSource is BindingSource && GetReadValuesOnChange((BindingSource)e.Binding.DataSource)) { e.Binding.ReadValue(); } break; } }
public void Binding_OnBindingComplete_Invoke_CallsBindingComplete(BindingCompleteEventArgs eventArgs) { var binding = new SubBinding("propertyName", new object(), "dataMember"); // No handler. binding.OnBindingComplete(eventArgs); // Handler. int callCount = 0; BindingCompleteEventHandler handler = (sender, e) => { Assert.Equal(binding, sender); Assert.Same(eventArgs, e); callCount++; }; binding.BindingComplete += handler; binding.OnBindingComplete(eventArgs); Assert.Equal(1, callCount); // Should not call if the handler is removed. binding.BindingComplete -= handler; binding.OnBindingComplete(eventArgs); Assert.Equal(1, callCount); }
private void projectUnitsBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState != BindingCompleteState.Success) { System.Diagnostics.Debug.WriteLine("Units Binding Error:"); } }
private void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState == BindingCompleteState.Exception) { GlobalExceptionHandler.ShowExceptionMessageBox(this, e.ErrorText); e.Cancel = true; } }
protected virtual void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState == BindingCompleteState.Exception) { ExceptionHandlers.ShowExceptionMessageBox(this, e.ErrorText); e.Cancel = true; } }
void batchNoBinding_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState != BindingCompleteState.Success) { GlobalExceptionHandler.ShowExceptionMessageBox(this, e.ErrorText); e.Cancel = true; } }
private void BindingCompleted(object sender, BindingCompleteEventArgs e) { Control errorProviderAnchor = InputValidationProvider.GetErrorProviderAnchor(e.Binding.Control); if (e.BindingCompleteState != BindingCompleteState.Success) { if (e.BindingCompleteContext == BindingCompleteContext.DataSourceUpdate) { StrongTypeException ex = e.Exception as StrongTypeException; if ((ex == null || ex.IsTargetProperty) && e.Binding.Control.Enabled) { this.GetErrorProvider((BindingSource)e.Binding.DataSource).SetError(errorProviderAnchor, e.ErrorText); this.AddErrorBindingForControl(e.Binding); } e.Binding.ControlUpdateMode = ControlUpdateMode.Never; } } else { e.Binding.ControlUpdateMode = ControlUpdateMode.OnPropertyChanged; if (this.RemoveSuccessfulBindingForControl(e.Binding)) { this.GetErrorProvider((BindingSource)e.Binding.DataSource).SetError(errorProviderAnchor, string.Empty); } } e.Cancel = false; this.SetModifiedBindingMembers(e); }
private void SetModifiedBindingMembers(BindingCompleteEventArgs e) { if (!this.SuspendRecordingModifiedBindingMembers && e.BindingCompleteContext.Equals(BindingCompleteContext.DataSourceUpdate)) { object dataSource = e.Binding.DataSource; string bindingField = e.Binding.BindingMemberInfo.BindingField; object key; if (dataSource is BindingSource) { key = (dataSource as BindingSource).DataSource; } else { key = dataSource; } if (this.ModifiedBindingMembers.ContainsKey(key)) { if (!this.ModifiedBindingMembers[key].Contains(bindingField)) { this.ModifiedBindingMembers[key].Add(bindingField); return; } } else { List <string> list = new List <string>(); list.Add(bindingField); this.ModifiedBindingMembers.Add(key, list); } } }
protected override void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e) { base.CommonControl_BindingComplete(sender, e); if (this.EditableMode) { if (sender.Equals(this.bindingForecastLocationID) && this.combexForecastLocationID.SelectedItem != null) { LocationBase locationBase = (LocationBase)this.combexForecastLocationID.SelectedItem; this.forecastViewModel.ForecastLocationName = locationBase.Name; } } if (sender.Equals(this.bindingEntryDate)) { if (this.forecastDate != this.forecastViewModel.EntryDate) { this.forecastDate = this.forecastViewModel.EntryDate; this.Quantity.HeaderText = "Forecast." + ((DateTime)this.forecastViewModel.EntryDate).ToString("MMM-yy"); this.QuantityM1.HeaderText = "Forecast." + ((DateTime)this.forecastViewModel.EntryDate).AddMonths(1).ToString("MMM-yy"); this.QuantityM2.HeaderText = "Forecast." + ((DateTime)this.forecastViewModel.EntryDate).AddMonths(2).ToString("MMM-yy"); this.QuantityM3.HeaderText = "Forecast." + ((DateTime)this.forecastViewModel.EntryDate).AddMonths(3).ToString("MMM-yy"); this.LineVolume.HeaderText = this.Quantity.HeaderText; this.LineVolumeM1.HeaderText = this.QuantityM1.HeaderText; this.LineVolumeM2.HeaderText = this.QuantityM2.HeaderText; this.LineVolumeM3.HeaderText = this.QuantityM3.HeaderText; StackedHeaderDecorator stackedHeaderDecorator = new StackedHeaderDecorator(this.gridexViewDetails); } } }
/// <summary> /// Обработка ошибок ввода данных /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void OnBindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState != BindingCompleteState.Success) { Utils.InfoMessageBox("Ошибка ввода данных:\r\n " + e.ErrorText); } }
private void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState == BindingCompleteState.Exception) { ExceptionHandlers.ShowExceptionMessageBox(this, e.ErrorText); e.Cancel = true; } if (sender.Equals(this.bindingWarehouseID)) { if (this.combexWarehouseID.SelectedItem != null) { WarehouseBase warehouseBase = (WarehouseBase)this.combexWarehouseID.SelectedItem; this.warehouseAdjustmentViewModel.WarehouseName = warehouseBase.Name; } } if (sender.Equals(this.bindingWarehouseReceiptID)) { if (this.combexWarehouseReceiptID.SelectedItem != null) { WarehouseBase warehouseBase = (WarehouseBase)this.combexWarehouseReceiptID.SelectedItem; this.warehouseAdjustmentViewModel.WarehouseReceiptName = warehouseBase.Name; } } if (sender.Equals(this.bindingWarehouseAdjustmentTypeID)) { if (this.combexWarehouseAdjustmentTypeID.SelectedItem != null) { WarehouseAdjustmentTypeBase warehouseAdjustmentTypeBase = (WarehouseAdjustmentTypeBase)this.combexWarehouseAdjustmentTypeID.SelectedItem; this.warehouseAdjustmentViewModel.WarehouseAdjustmentTypeName = warehouseAdjustmentTypeBase.Name; } } }
void binding_BindingComplete(object sender, BindingCompleteEventArgs e) { DateTimePicker pk = e.Binding.Control as DateTimePicker; if (pk == null) { return; } BindingSource bs = e.Binding.DataSource as BindingSource; object val = MB.Util.MyReflection.Instance.InvokePropertyForGet(bs.Current, e.Binding.BindingMemberInfo.BindingField); if (e.BindingCompleteContext == BindingCompleteContext.ControlUpdate) { if (val == null || val == System.DBNull.Value) { pk.Checked = false; } else { pk.Checked = true; } } else { if (!pk.Checked) { MB.Util.MyReflection.Instance.InvokePropertyForSet(bs.Current, e.Binding.BindingMemberInfo.BindingField, null); } } }
private void recorderProjectBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e) { if (!_currentProject.IsDirty && (e.BindingCompleteState == BindingCompleteState.Success) && e.Binding.Control.Focused) { SetDirtyFlag(); } }
private void YemeklerBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState == BindingCompleteState.Success) { MalzemeListesiYukle(); } }
protected override void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e) { base.CommonControl_BindingComplete(sender, e); if (this.EditableMode) { if (sender.Equals(this.bindingSalespersonID) && this.combexSalespersonID.SelectedItem != null) { EmployeeBase customerBase = (EmployeeBase)this.combexSalespersonID.SelectedItem; this.deliveryAdviceViewModel.TeamID = customerBase.TeamID; } if (sender.Equals(this.bindingCustomerID) && this.combexCustomerID.SelectedItem != null) { CustomerBase customerBase = (CustomerBase)this.combexCustomerID.SelectedItem; this.deliveryAdviceViewModel.CustomerName = customerBase.Name; //HERE: CHANGE => DONT SET setDirty: SEE ApplyPropertyChange FOR MORE INFO //THIS CommonControl_BindingComplete WILL BE RAISED FOR EVERY BINDING => SO WE CAN NOT UPDATE RELATIVE PROPERTY BY THIS WAY. SHOULD THINK OF NEW WAY FOR UPDATE SUCH RELATIVE PROPERTY (SUCH AS: ContactInfo, ShippingAddress OF Customer) //this.deliveryAdviceViewModel.ContactInfo = customerBase.ContactInfo; //this.deliveryAdviceViewModel.ShippingAddress = customerBase.ShippingAddress; } if (sender.Equals(this.bindingReceiverID) && this.combexReceiverID.SelectedItem != null) { CustomerBase receiverBase = (CustomerBase)this.combexReceiverID.SelectedItem; this.deliveryAdviceViewModel.ReceiverName = receiverBase.Name; //THIS CommonControl_BindingComplete WILL BE RAISED FOR EVERY BINDING => SO WE CAN NOT UPDATE RELATIVE PROPERTY BY THIS WAY. SHOULD THINK OF NEW WAY FOR UPDATE SUCH RELATIVE PROPERTY (SUCH AS: ContactInfo, ShippingAddress OF Receiver) //this.deliveryAdviceViewModel.ContactInfo = receiverBase.ContactInfo; //this.deliveryAdviceViewModel.ShippingAddress = receiverBase.ShippingAddress; } } }
private void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState == BindingCompleteState.Exception) { ExceptionHandlers.ShowExceptionMessageBox(this, e.ErrorText); e.Cancel = true; } if (sender.Equals(this.bindingCustomerID)) { if (this.combexCustomerID.SelectedItem != null) { CustomerBase customerBase = (CustomerBase)this.combexCustomerID.SelectedItem; this.salesOrderViewModel.CustomerName = customerBase.Name; this.salesOrderViewModel.ContactInfo = customerBase.ContactInfo; this.salesOrderViewModel.SalespersonID = customerBase.SalespersonID; //this.salesOrderViewModel.ReceiverID = customerBase.CustomerID; } } if (sender.Equals(this.bindingReceiverID)) { if (this.combexReceiverID.SelectedItem != null) { CustomerBase customerBase = (CustomerBase)this.combexReceiverID.SelectedItem; this.salesOrderViewModel.ReceiverName = customerBase.Name; this.salesOrderViewModel.ShippingAddress = customerBase.ShippingAddress; } } }
private void Source_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteContext == BindingCompleteContext.DataSourceUpdate && e.Exception == null) { e.Binding.BindingManagerBase.EndCurrentEdit(); } }
void StationBindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState != BindingCompleteState.Success) { LogHelper.Error(e.ErrorText); } }
void bindingSource_BindingComplete(object sender, BindingCompleteEventArgs e) { this.binSourceBusStation.EndEdit(); T t = (T)binSourceBusStation.Current; repository.Save(t); }
protected override void OnBindingComplete(BindingCompleteEventArgs e) { if (e.BindingCompleteState != BindingCompleteState.Success) { Log.Error("Failed Binding Event", e.Exception); } base.OnBindingComplete(e); }
// Handle the BindingComplete event to catch errors and // exceptions in binding process. void partNameBinding_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState != BindingCompleteState.Success) { MessageBox.Show("partNameBinding: " + e.ErrorText); } }
private void button1_Click(object sender, BindingCompleteEventArgs e) { if (folderBrowserDialog.ShowDialog() != DialogResult.OK) { return; } textBox1.Text = folderBrowserDialog.SelectedPath; }
// MONO BUG: This does not run on Mono private void locationSettingsBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteContext == BindingCompleteContext.DataSourceUpdate) { e.Binding.BindingManagerBase.EndCurrentEdit(); FireKeyLocationChanged(); } }
private void HandlerBindingComplete(object sender, BindingCompleteEventArgs e) { Binding binding = e.Binding; if (binding != null && binding.Control != null) { SetError(binding.Control, (e.ErrorText == null ? string.Empty : e.ErrorText)); } }
private void bdsVWareHouseDetail_BindingComplete(object sender, BindingCompleteEventArgs e) { var list = (List <VWareHouseDetail>) this.bdsVWareHouseDetail.List; foreach (var item in list) { item.PropertyChanged += new PropertyChangedEventHandler(item_PropertyChanged); } }
private void trackBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e) { Logger.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name); currentModelJson = Newtonsoft.Json.JsonConvert.SerializeObject(model); if (currentModelJson != lastModelJson) { GenerateModel(); lastModelJson = Newtonsoft.Json.JsonConvert.SerializeObject(model); } }
private void bindingSourceMain_BindingComplete(object sender, BindingCompleteEventArgs e) { // Check if the data source has been updated, and that no error has occured. if (e.BindingCompleteContext == BindingCompleteContext.DataSourceUpdate && e.Exception == null) { // If not, end the current edit. e.Binding.BindingManagerBase.EndCurrentEdit(); } }
public void Ctor_Binding_BindingCompleteState_BindingCompleteContext_String_Exception_Bool(Binding binding, BindingCompleteState state, BindingCompleteContext context, string errorText, Exception exception, bool cancel) { var e = new BindingCompleteEventArgs(binding, state, context, errorText, exception, cancel); Assert.Equal(binding, e.Binding); Assert.Equal(state, e.BindingCompleteState); Assert.Equal(context, e.BindingCompleteContext); Assert.Equal(errorText ?? "", e.ErrorText); Assert.Equal(exception, e.Exception); Assert.Equal(cancel, e.Cancel); }
private void enquiryInprogressBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e) { Data.Models.Enquiry EnquiryObj = (Data.Models.Enquiry)(enquiryInprogressBindingSource.Current); if (EnquiryObj != null) { if (EnquiryObj.Companies.Count == 0) { txtInprogressCompanyName.Text = "NA - Private Enquiry"; } } }
private void orderBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e) { orderBindingSource.BindingComplete -= orderBindingSource_BindingComplete; if (e.BindingCompleteState != BindingCompleteState.Success) { var textBox = e.Binding.BindableComponent as TextBox; if (textBox != null && textBox.Name == "orderDateTextBox") { textBox.Text = ((sender as BindingSource).Current as Order).OrderDate; } } }
protected virtual void OnBindingComplete(BindingCompleteEventArgs e) { BindingCompleteEventHandler eh = (BindingCompleteEventHandler) Events[BindingCompleteEvent]; if (eh != null) eh (this, e); }
protected virtual void OnBindingComplete(BindingCompleteEventArgs e) { if (BindingComplete != null) BindingComplete (this, e); }
void FireBindingComplete(BindingCompleteContext context, Exception exc, string error_message) { BindingCompleteEventArgs args = new BindingCompleteEventArgs (this, exc == null ? BindingCompleteState.Success : BindingCompleteState.Exception, context); if (exc != null) { args.SetException (exc); args.SetErrorText (error_message); } OnBindingComplete (args); }
protected void OnBindingComplete(BindingCompleteEventArgs args) { if (BindingComplete != null) BindingComplete (this, args); }