protected virtual void OnBeforeSelect(CancelWithDataEventArgs e) { if (this.BeforeSelect != null) { this.BeforeSelect(this, e); } }
protected virtual void OnValueChanging(CancelWithDataEventArgs e) { if (this.ValueChanging != null) { this.ValueChanging(this, e); } }
public void SetValue(BAL.Types.DateFromTo fromTo, FromToType type) { var args = new CancelWithDataEventArgs(fromTo); OnValueChanging(args); if (!args.Cancel) { this.value = fromTo; this.type = type; showFromTo(); if (!blockEvents) { OnValueChanged(new EventArgs()); } } }
private void button_Click(object sender, EventArgs e) { if (this.DataContext == null) { this.DataContext = this.CreateDataContext(); } if (this.DataContext != null && typeof(BAL.Business.View).IsAssignableFrom(this.DataContext.GetType())) { if (FormManager.Instance.ShowGridFormDialog((BAL.Business.View) this.DataContext) == DialogResult.OK) { var arg = new CancelWithDataEventArgs(this.DataContext.Current); OnValueChanging(arg); if (!arg.Cancel) { this.setSelectedItem(this.DataContext.Current); this.OnValueChanged(new EventArgs()); return; } } this.setSelectedItem(null); } }