protected void OnBindingComplete(BindingCompleteEventArgs args) { if (BindingComplete != null) { BindingComplete(this, args); } }
protected virtual void OnBindingComplete(BindingCompleteEventArgs e) { if (!this.inOnBindingComplete) { try { this.inOnBindingComplete = true; if (this.onComplete != null) { this.onComplete(this, e); } } catch (Exception exception) { if (System.Windows.Forms.ClientUtils.IsSecurityOrCriticalException(exception)) { throw; } e.Cancel = true; } finally { this.inOnBindingComplete = false; } } }
/// <include file='doc\BindingMAnagerBase.uex' path='docs/doc[@for="BindingManagerBase.OnBindingComplete"]/*' /> internal protected void OnBindingComplete(BindingCompleteEventArgs args) { if (onBindingCompleteHandler != null) { onBindingCompleteHandler(this, args); } }
protected virtual void OnBindingComplete(BindingCompleteEventArgs e) { if (BindingComplete != null) { BindingComplete(this, e); } }
/// <include file='doc\ListBinding.uex' path='docs/doc[@for="Binding.OnBindingComplete"]/*' /> protected virtual void OnBindingComplete(BindingCompleteEventArgs e) { // This recursion guard will only be in effect if FormattingEnabled because this method // is only called if formatting is enabled. if (!inOnBindingComplete) { try { inOnBindingComplete = true; if (onComplete != null) { onComplete(this, e); } } catch (Exception ex) { if (ClientUtils.IsSecurityOrCriticalException(ex)) { throw; } // BindingComplete event is intended primarily as an "FYI" event with support for cancellation. // User code should not be throwing exceptions from this event as a way to signal new error conditions (they should use // things like the Format or Parse events for that). Exceptions thrown here can mess up currency manager behavior big time. // For now, eat any non-critical exceptions and instead just cancel the current push/pull operation. e.Cancel = true; } finally { inOnBindingComplete = false; } } }
private void _BindingComplete(System.Object sender, System.Windows.Forms.BindingCompleteEventArgs e) { if (e.BindingCompleteContext == BindingCompleteContext.DataSourceUpdate) { if (e.BindingCompleteState == BindingCompleteState.Success & !e.Binding.Control.BindingContext.IsReadOnly) { //Make sure the data source value is refreshed (fixes problem mousing off control) e.Binding.ReadValue(); //if not focused then not a user edit. if (!e.Binding.Control.Focused) { return; } //check for the lookup type of combobox that changes position instead of value if (e.Binding.Control as ComboBox != null) { //if the combo box has the same data member table as the binding source, ignore it if (((ComboBox)e.Binding.Control).DataSource != null) { if (((ComboBox)e.Binding.Control).DataSource as BindingSource != null) { if (((BindingSource)((ComboBox)e.Binding.Control).DataSource).DataMember == (this.DataMember)) { return; } } } } IsCurrentDirty = true; //set the dirty flag because data was changed } } }
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); } }
protected virtual void OnBindingComplete(BindingCompleteEventArgs e) { BindingCompleteEventHandler eh = (BindingCompleteEventHandler)Events[BindingCompleteEvent]; if (eh != null) { eh(this, e); } }
private void bindingSource1_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(); }
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; } } }
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); }
internal bool PushData(bool force) { object obj2 = null; Exception ex = null; if (force || (this.ControlUpdateMode != System.Windows.Forms.ControlUpdateMode.Never)) { if (this.inPushOrPull && this.formattingEnabled) { return(false); } this.inPushOrPull = true; try { if (this.IsBinding) { obj2 = this.bindToObject.GetValue(); object obj3 = this.FormatObject(obj2); this.SetPropValue(obj3); this.modified = false; } else { this.SetPropValue(null); } } catch (Exception exception2) { ex = exception2; if (!this.FormattingEnabled) { throw; } } finally { this.inPushOrPull = false; } if (this.FormattingEnabled) { BindingCompleteEventArgs e = this.CreateBindingCompleteEventArgs(BindingCompleteContext.ControlUpdate, ex); this.OnBindingComplete(e); return(e.Cancel); } } return(false); }
public void TestBindingCompleteEventArgs () { Binding b = new Binding ("TestBind", null, "TestMember"); BindingCompleteContext c = new BindingCompleteContext (); string errorText = "This is an error!"; Exception ex = new ArgumentNullException (); BindingCompleteEventArgs e = new BindingCompleteEventArgs (b, BindingCompleteState.Success, c); Assert.AreEqual (b, e.Binding, "A1"); Assert.AreEqual (BindingCompleteState.Success, e.BindingCompleteState, "A2"); Assert.AreEqual (c, e.BindingCompleteContext, "A3"); Assert.AreEqual (false, e.Cancel, "A4"); Assert.AreEqual (String.Empty, e.ErrorText, "A5"); Assert.AreEqual (null, e.Exception, "A6"); BindingCompleteEventArgs e2 = new BindingCompleteEventArgs (b, BindingCompleteState.Success, c, errorText); Assert.AreEqual (b, e2.Binding, "B1"); Assert.AreEqual (BindingCompleteState.Success, e2.BindingCompleteState, "B2"); Assert.AreEqual (c, e2.BindingCompleteContext, "B3"); Assert.AreEqual (false, e2.Cancel, "B4"); Assert.AreEqual (errorText, e2.ErrorText, "B5"); Assert.AreEqual (null, e2.Exception, "B6"); BindingCompleteEventArgs e3 = new BindingCompleteEventArgs (b, BindingCompleteState.Success, c, errorText, ex); Assert.AreEqual (b, e3.Binding, "C1"); Assert.AreEqual (BindingCompleteState.Success, e3.BindingCompleteState, "C2"); Assert.AreEqual (c, e3.BindingCompleteContext, "C3"); Assert.AreEqual (false, e3.Cancel, "C4"); Assert.AreEqual (errorText, e3.ErrorText, "C5"); Assert.AreEqual (ex, e3.Exception, "C6"); BindingCompleteEventArgs e4 = new BindingCompleteEventArgs (b, BindingCompleteState.Success, c, errorText, ex, true); Assert.AreEqual (b, e4.Binding, "D1"); Assert.AreEqual (BindingCompleteState.Success, e4.BindingCompleteState, "D2"); Assert.AreEqual (c, e4.BindingCompleteContext, "D3"); Assert.AreEqual (true, e4.Cancel, "D4"); Assert.AreEqual (errorText, e4.ErrorText, "D5"); Assert.AreEqual (ex, e4.Exception, "D6"); }
/// <summary> /// происходит при связывании закончилась, показать пользователю, если мы смогли записать значения или нет. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Binding_BindingComplete(object sender, BindingCompleteEventArgs e) { // when we are pushing from control to DataTable if (e.BindingCompleteContext == BindingCompleteContext.DataSourceUpdate) { if (e.BindingCompleteState == BindingCompleteState.Success) { this.BindingOK = true; this.textBox_FieldValue.BackColor = Success; } else { // ignore erorrs, they will be brought to user once again when he tries to submit. e.Cancel = false; this.BindingOK = false; this.textBox_FieldValue.BackColor = Failure; } } }
internal bool PullData(bool reformat, bool force) { //Don't update the control if the control update mode is never. if (ControlUpdateMode == ControlUpdateMode.Never) { reformat = false; } bool parseFailed = false; object parsedValue = null; Exception lastException = null; // Check whether binding has been suspended or is simply not possible right now if (!IsBinding) { return(false); } // If caller is not FORCING us to pull, determine whether we want to pull right now... if (!force) { // If control property supports change events, only pull if the value has been changed since // the last update (ie. its dirty). For properties that do NOT support change events, we cannot // track the dirty state, so we just have to pull all the time. if (propInfo.SupportsChangeEvents && !modified) { return(false); } // Don't pull if the update mode is 'Never' (ie. read-only binding) if (DataSourceUpdateMode == DataSourceUpdateMode.Never) { return(false); } } // Re-entrancy check between push and pull (new for Whidbey - requires FormattingEnabled) if (inPushOrPull && formattingEnabled) { return(false); } inPushOrPull = true; // Get the value from the bound control property object value = GetPropValue(); // Attempt to parse the property value into a format suitable for the data source try { parsedValue = ParseObject(value); } catch (Exception ex) { lastException = ex; // ...pre-Whidbey behavior was to eat parsing exceptions. This behavior is preserved. } try { // If parse failed, reset control property value back to original data source value. // An exception always indicates a parsing failure. A parsed value of null only indicates // a parsing failure when following pre-Whidbey behavior (ie. FormattingEnabled=False) since // in Whidbey we now support writing null back to the data source (eg. for business objects). if (lastException != null || (!FormattingEnabled && parsedValue == null)) { parseFailed = true; parsedValue = this.bindToObject.GetValue(); } // Format the parsed value to be re-displayed in the control if (reformat) { if (FormattingEnabled && parseFailed) { // New behavior for Whidbey (ie. requires FormattingEnabled=true). If parsing // fails, do NOT push the original data source value back into the control. // This blows away the invalid value before the user gets a chance to see // what needs correcting, which was the Everett behavior. } else { object formattedObject = FormatObject(parsedValue); if (force || !FormattingEnabled || !Object.Equals(formattedObject, value)) { SetPropValue(formattedObject); } } } // Put the value into the data model if (!parseFailed) { this.bindToObject.SetValue(parsedValue); } } catch (Exception ex) { lastException = ex; // This try/catch is new for Whidbey. To preserve Everett behavior, re-throw the // exception unless this binding has formatting enabled (new Whidbey feature). if (!FormattingEnabled) { throw; } } finally { inPushOrPull = false; } if (FormattingEnabled) { // Whidbey... // Raise the BindingComplete event, giving listeners a chance to process any // errors that occured and decide whether the operation should be cancelled. BindingCompleteEventArgs args = CreateBindingCompleteEventArgs(BindingCompleteContext.DataSourceUpdate, lastException); OnBindingComplete(args); // If the operation completed successfully (and was not cancelled), we can clear the dirty flag // on this binding because we know the value in the control was valid and has been accepted by // the data source. But if the operation failed (or was cancelled), we must leave the dirty flag // alone, so that the control's value will continue to be re-validated and re-pulled later. if (args.BindingCompleteState == BindingCompleteState.Success && args.Cancel == false) { modified = false; } return(args.Cancel); } else { // Everett... // Do not emit BindingComplete events, or allow the operation to be cancelled. // If we get this far, treat the operation as successful and clear the dirty flag. modified = false; return(false); } }
private void linkBinding_BindingComplete(object sender, BindingCompleteEventArgs e) { //e.Binding.PropertyName; if (isFirstTab) { var Item = scanItems[scanListView.SelectedIndices[0]]; var ourItem = Item.Steam.scanInput; scanListView.SelectedItems[0].SubItems[2].Text = ourItem.Price; if (Item.Steam.scaninProg) { return; } if (isScanValid(ourItem, true)) { ourItem.StatId = status.Ready; setStatImg(scanListView.SelectedIndices[0], ourItem.StatId, scanListView); } else { ourItem.StatId = status.Warning; setStatImg(scanListView.SelectedIndices[0], ourItem.StatId, scanListView); } setButtText(ourItem.StatId); } else { var Item = steam_srch.recentInputList[recentListView.SelectedIndices[0]]; recentListView.SelectedItems[0].SubItems[2].Text = Item.Price; if (steam_srch.scaninProg) { return; } if (isScanValid(Item, false)) { Item.StatId = status.Ready; setStatImg(recentListView.SelectedIndices[0], status.Ready, recentListView); } else { Item.StatId = status.Warning; setStatImg(recentListView.SelectedIndices[0], status.Warning, recentListView); } setButtText(Item.StatId); } }
protected internal void OnBindingComplete(BindingCompleteEventArgs args) { _onBindingCompleteHandler?.Invoke(this, args); }
internal bool PushData(bool force) { object dataSourceValue = null; Exception lastException = null; // Don't push if update mode is 'Never' (unless caller is FORCING us to push) if (!force && ControlUpdateMode == ControlUpdateMode.Never) { return(false); } // Re-entrancy check between push and pull (new for Whidbey - requires FormattingEnabled) if (inPushOrPull && formattingEnabled) { return(false); } inPushOrPull = true; try { if (IsBinding) { dataSourceValue = bindToObject.GetValue(); object controlValue = FormatObject(dataSourceValue); SetPropValue(controlValue); modified = false; } else { SetPropValue(null); } } catch (Exception ex) { lastException = ex; // This try/catch is new for Whidbey. To preserve Everett behavior, re-throw the // exception unless this binding has formatting enabled (new Whidbey feature). if (!FormattingEnabled) { throw; } } finally { inPushOrPull = false; } if (FormattingEnabled) { // Whidbey... // Raise the BindingComplete event, giving listeners a chance to process any errors that occured, and decide // whether the operation should be cancelled. But don't emit the event if we didn't actually update the control. BindingCompleteEventArgs args = CreateBindingCompleteEventArgs(BindingCompleteContext.ControlUpdate, lastException); OnBindingComplete(args); return(args.Cancel); } else { // Everett... // Do not emit BindingComplete events, or allow the operation to be cancelled. return(false); } }
private void CurrencyManager_BindingComplete(object sender, BindingCompleteEventArgs e) { OnBindingComplete(e); }
internal void Binding_BindingComplete(object sender, BindingCompleteEventArgs args) { this.OnBindingComplete(args); }
/// <summary> /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed. /// <example> /// bindingcompleteeventhandler.BeginInvoke(sender, e, callback); /// </example> /// </summary> public static IAsyncResult BeginInvoke(this BindingCompleteEventHandler bindingcompleteeventhandler, Object sender, BindingCompleteEventArgs e, AsyncCallback callback) { if(bindingcompleteeventhandler == null) throw new ArgumentNullException("bindingcompleteeventhandler"); return bindingcompleteeventhandler.BeginInvoke(sender, e, callback, null); }
private void DataSource_BindingComplete(object sender, BindingCompleteEventArgs e) { UpdateBindingsAndProcessAllControls(); }
protected void b_BindingComplete(object sender, BindingCompleteEventArgs e) { }
private void bind_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.Binding.BindingMemberInfo.BindingField.Equals("Name", StringComparison.OrdinalIgnoreCase)) { AntennaEntity current = this.m_myCurrency.Current as AntennaEntity; this.dgv_HGain.DataSource = current.HoriAtt; this.dgv_VGain.DataSource = current.VertAtt; Rectangle rectangle = new Rectangle(this.panel_HGain.Location, this.panel_HGain.Size); DrawGain gain = new DrawGain(current.HoriAttData, current.Gain, rectangle.Width, rectangle.Height); this.panel_HGain.BackgroundImageLayout = ImageLayout.Zoom; this.panel_HGain.BackgroundImage = gain.DrawGains(); rectangle = new Rectangle(this.panel_VGain.Location, this.panel_VGain.Size); gain = new DrawGain(current.VertAttData, current.Gain, rectangle.Width, rectangle.Height); this.panel_VGain.BackgroundImageLayout = ImageLayout.Zoom; this.panel_VGain.BackgroundImage = gain.DrawGains(); this.btn_App.Enabled = false; } if (e.Binding.PropertyName.Equals("Value", StringComparison.OrdinalIgnoreCase)) { this.btn_App.Enabled = false; } }
/// <include file='doc\BindingMAnagerBase.uex' path='docs/doc[@for="BindingManagerBase.OnBindingComplete"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> internal protected void OnBindingComplete(BindingCompleteEventArgs args) { if (onBindingCompleteHandler != null) { onBindingCompleteHandler(this, args); } }
internal void Binding_BindingComplete(object sender, BindingCompleteEventArgs args) { this.OnBindingComplete(args); }
protected void OnBindingComplete (BindingCompleteEventArgs args) { if (BindingComplete != null) BindingComplete (this, args); }
protected virtual void OnBindingComplete(BindingCompleteEventArgs e) { BindingCompleteEventHandler handler = (BindingCompleteEventHandler) base.Events[EVENT_BINDINGCOMPLETE]; if (handler != null) { handler(this, e); } }
internal bool PullData(bool reformat, bool force) { if (this.ControlUpdateMode == System.Windows.Forms.ControlUpdateMode.Never) { reformat = false; } bool flag = false; object obj2 = null; Exception ex = null; if (this.IsBinding) { if (!force) { if (this.propInfo.SupportsChangeEvents && !this.modified) { return(false); } if (this.DataSourceUpdateMode == System.Windows.Forms.DataSourceUpdateMode.Never) { return(false); } } if (this.inPushOrPull && this.formattingEnabled) { return(false); } this.inPushOrPull = true; object propValue = this.GetPropValue(); try { obj2 = this.ParseObject(propValue); } catch (Exception exception2) { ex = exception2; } try { if ((ex != null) || (!this.FormattingEnabled && (obj2 == null))) { flag = true; obj2 = this.bindToObject.GetValue(); } if (reformat && (!this.FormattingEnabled || !flag)) { object objA = this.FormatObject(obj2); if ((force || !this.FormattingEnabled) || !object.Equals(objA, propValue)) { this.SetPropValue(objA); } } if (!flag) { this.bindToObject.SetValue(obj2); } } catch (Exception exception3) { ex = exception3; if (!this.FormattingEnabled) { throw; } } finally { this.inPushOrPull = false; } if (this.FormattingEnabled) { BindingCompleteEventArgs e = this.CreateBindingCompleteEventArgs(BindingCompleteContext.DataSourceUpdate, ex); this.OnBindingComplete(e); if ((e.BindingCompleteState == BindingCompleteState.Success) && !e.Cancel) { this.modified = false; } return(e.Cancel); } this.modified = false; } return(false); }
protected virtual void OnBindingComplete (BindingCompleteEventArgs e) { BindingCompleteEventHandler eh = (BindingCompleteEventHandler) Events[BindingCompleteEvent]; if (eh != null) eh (this, e); }
void bs_BindingComplete(object sender, BindingCompleteEventArgs e) { tsRowCount.Text = string.Format("Rows: {0}", dgvGrid.Rows.Count); }
/// <include file='doc\BindingSource.uex' path='docs/doc[@for="BindingSource.OnBindingComplete"]/*' /> protected virtual void OnBindingComplete(BindingCompleteEventArgs e) { BindingCompleteEventHandler eh = (BindingCompleteEventHandler) Events[EVENT_BINDINGCOMPLETE]; if (eh != null) eh(this, e); }
protected override void OnBindingComplete(BindingCompleteEventArgs e) { base.OnBindingComplete(e); this.Control.Validating += new CancelEventHandler(Control_Validating); }
void InfoPictureBox_BindingComplete(object sender, BindingCompleteEventArgs e) { object[] myRet = CliUtils.CallMethod("GLModule", "DownLoadFile", new object[] { this.DefaultPath + "\\" + this.ImagePath }); if (myRet != null && (int)myRet[0] == 0) { if ((int)myRet[1] == 0) { byte[] bfile = (byte[])myRet[2]; MemoryStream ms = new MemoryStream(bfile); this.Image = System.Drawing.Image.FromStream(ms); } else { this.Image = null; } } }
private void bindingSource_BindingComplete(object sender, BindingCompleteEventArgs e) { //Log("BindingComplete"); }
private void ErrorManager_BindingComplete(object sender, BindingCompleteEventArgs e) { Binding binding = e.Binding; if (binding != null && binding.Control != null) { SetError(binding.Control, (e.ErrorText == null ? String.Empty : e.ErrorText)); } }
protected void BindingComplete (object sender, BindingCompleteEventArgs args) { //Console.WriteLine (Environment.StackTrace); event_log += String.Format ("{0}: BindingComplete\n", event_num++); }
private void ErrorManager_BindingComplete(object sender, BindingCompleteEventArgs e) { Binding binding = e.Binding; if ((binding != null) && (binding.Control != null)) { this.SetError(binding.Control, (e.ErrorText == null) ? string.Empty : e.ErrorText); } }
protected virtual void OnBindingComplete (BindingCompleteEventArgs e) { if (BindingComplete != null) BindingComplete (this, e); }
protected virtual void OnBindingComplete(BindingCompleteEventArgs e) { throw null; }
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); }
private void nameBinding_BindingComplete(object sender, BindingCompleteEventArgs e) { if (isFirstTab) { var Item = scanItems[scanListView.SelectedIndices[0]]; var ourItem = Item.Steam.scanInput; scanListView.SelectedItems[0].SubItems[1].Text = ourItem.Name; SetColumnWidths(scanListView, true); } else { var Item = steam_srch.recentInputList[recentListView.SelectedIndices[0]]; recentListView.SelectedItems[0].SubItems[1].Text = Item.Name; SetColumnWidths(recentListView, true); } }
private void studentsBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e) { }
/// <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; } }
private void gürtelBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e) { }