public void addingNewEventArgs_ctor_normal_should_set_expected_values() { var expected = new GenericParameterHelper(); var target = new AddingNewEventArgs<GenericParameterHelper>(); target.NewItem = expected; var actual = target.NewItem; actual.Should().Be.EqualTo( expected ); target.Cancel.Should().Be.False(); }
object IBindingList.AddNew() { #pragma warning disable CS0436 // Type conflicts with imported type var args = new AddingNewEventArgs(); #pragma warning restore CS0436 // Type conflicts with imported type OnAddingNew(args); if (args.NewObject == null) { throw new JsonException("Could not determine new value to add to '{0}'.".FormatWith(CultureInfo.InvariantCulture, GetType())); } if (!(args.NewObject is JToken)) { throw new JsonException("New item to be added to collection must be compatible with {0}.".FormatWith(CultureInfo.InvariantCulture, typeof(JToken))); } JToken newItem = (JToken)args.NewObject; Add(newItem); return(newItem); }
object IBindingList.AddNew() { AddingNewEventArgs args = new AddingNewEventArgs(); OnAddingNew(args); if (args.NewObject == null) { throw new JsonException("Could not determine new value to add to '{0}'.".FormatWith(CultureInfo.InvariantCulture, GetType())); } if (!(args.NewObject is JToken)) { throw new JsonException("New item to be added to collection must be compatible with {0}.".FormatWith(CultureInfo.InvariantCulture, typeof(JToken))); } JToken newItem = (JToken)args.NewObject; Add(newItem); return(newItem); }
object IBindingList.AddNew() { AddingNewEventArgs e = new AddingNewEventArgs(); this.OnAddingNew(e); if (e.NewObject == null) { throw new JsonException( "Could not determine new value to add to '{0}'.".FormatWith((IFormatProvider)CultureInfo.InvariantCulture, (object)this.GetType())); } if (!(e.NewObject is JToken)) { throw new JsonException( "New item to be added to collection must be compatible with {0}.".FormatWith( (IFormatProvider)CultureInfo.InvariantCulture, (object)typeof(JToken))); } JToken newObject = (JToken)e.NewObject; this.Add((object)newObject); return((object)newObject); }
protected override void OnAddingNew(AddingNewEventArgs e) { if (AllowNew) { IRow newRow = m_WrappedTable.CreateRow(); e.NewObject = newRow; for (int i = 0; i < newRow.Fields.FieldCount; i++) { IField curField = newRow.Fields.get_Field(i); if (curField.Editable && curField.IsNullable) { newRow.set_Value(i, curField.DefaultValue); } } bool weStartedEditing = StartEditOp(); newRow.Store(); StopEditOp(weStartedEditing); base.OnAddingNew(e); } }
protected override void OnAddingNew(AddingNewEventArgs e) { SynchronizationContext ctx = SynchronizationContext.Current; if (ctx == null) { BaseAddingNew(e); } else { try { ctx.Send(delegate { BaseAddingNew(e); }, null); } catch (Exception) { Console.WriteLine("Error"); } } }
private void BlocksBindingSource_AddingNew(object sender, AddingNewEventArgs e) { ReportBlock x = new ReportBlock(); e.NewObject = x; ReportTemplate t = (ReportTemplate)reportsBindingSource.Current; if (t.Blocks == null) { t.Blocks = new List <ReportBlock>(); } if (!string.IsNullOrEmpty(this.viewIDComboBox.Text)) { ds = (DataViewDataSource)DMEEditor.GetDataSource(this.viewIDComboBox.Text); EntityStructure ent = ds.GetEntityStructure(this.entityIDComboBox.Text, true); List <ReportBlockColumns> ls = new List <ReportBlockColumns>(); if (ent != null) { int i = 0; foreach (EntityField item in ent.Fields) { ReportBlockColumns c = new ReportBlockColumns(); c.ColumnName = item.fieldname; c.ColumnSeq = i; c.DisplayName = item.fieldname; c.Show = true; i += 1; ls.Add(c); } } x.BlockColumns = ls; } t.Blocks.Add(x); }
protected override object AddNewCore() { AddingNewEventArgs e = new AddingNewEventArgs(null); OnAddingNew(e); T newItem = (T)e.NewObject; if (newItem == null) { newItem = (T)Activator.CreateInstance(typeof(T), nonPublic: true); } object trackable = newItem as IChangeTrackable <T>; if (trackable == null) { trackable = ChangeTrackingFactory.Default.AsTrackable(newItem, ChangeStatus.Added, _ItemCanceled, _ChangeTrackingSettings, _Graph); var editable = (IEditableObject)trackable; editable.BeginEdit(); } Add((T)trackable); return(trackable); }
void UsersBindingSource_AddingNew(object sender, AddingNewEventArgs e) { if (this.LoginType == LoginType.UsernamePassword) { return; } // Note that MSDN states: // You cannot set the NewObject property when bound to a DataView or DataTable because you cannot add a new DataRowView to the list // But you can call AddNew inside this AddingNew event and change the default values if e.NewObject is set to the dataRowView // // When you set e.NewObject to something other then null: // * if the BindingSource.List.Count was increased during the eventhandler then it won't add e.NewObject to the list BindingSource bindingSource = sender as BindingSource; DataRowView dataRowView = ((DataView)bindingSource.List).AddNew(); UsersSource.UsersRow affectedRow = (UsersSource.UsersRow)dataRowView.Row; affectedRow.UserName = _newCardUserEdiNumber; affectedRow.FriendlyName = _newCardUserFriendlyName; affectedRow.NewPassword = new SecureString(); affectedRow.UseCardReader = true; e.NewObject = dataRowView; }
private void bindingInvoice_AddingNew(object sender, AddingNewEventArgs e) { /* This event will be called several times during form initialization. * We don't want to do anything with it until the runtime authors * list has been passed in. */ // Exit if no project list if (m_Invoices == null) { return; } // Create a new project commandInsertInvoice createInvoice = new commandInsertInvoice(); InvoiceItem newInvoice = (InvoiceItem)m_AppController.ExecuteCommand(createInvoice); /* Since the BindingSource is managing the collection, we pass the new * author to the BindingSource, using the NewObject property of the * event args. The BindingSource will add the new author to the * AuthorList for us. */ // Add it to theAuthors list e.NewObject = newInvoice; }
protected override object AddNewCore() { AddingNewEventArgs e = new AddingNewEventArgs(null); OnAddingNew(e); T newItem = (T)e.NewObject; if (newItem == null) { newItem = Activator.CreateInstance <T>(); } object trackable = newItem as IChangeTrackable <T>; if (trackable == null) { trackable = newItem.AsTrackable(ChangeStatus.Added, _ItemCanceled, _MakeComplexPropertiesTrackable, _MakeCollectionPropertiesTrackable); var editable = (IEditableObject)trackable; editable.BeginEdit(); } Add((T)trackable); return(trackable); }
void _list_AddingNew(object sender, AddingNewEventArgs e) { e.NewObject = new EmailType(); ((EmailType)e.NewObject).evtIsSavable += new IsSavableHandler(s_evtIsSavable); }
private void categoriaBindingSource_AddingNew(object sender, AddingNewEventArgs e) { HabilitaComponentesEdicao(true); }
private void list_AddinDeta(object sender, AddingNewEventArgs e) { e.NewObject = new V_INV_DETA_INGR(); }
// Accesing the 'base' member directly from anonymous method results in 'unverifiable' code (Compiler warning), so we use these helper methods (As compiler suggests) private void BaseOnAddingNew(AddingNewEventArgs e) { base.OnAddingNew(e); }
void BindingSource_AddingNew (object sender, AddingNewEventArgs e) { e.NewObject = new Customer ("Source"); }
private void bsPrePack_AddingNew(object sender, AddingNewEventArgs e) { }
protected void _actions_AddingNew(object sender, AddingNewEventArgs e) { AssertIsReady(); }
void _list_AddingNew(object sender, AddingNewEventArgs e) { e.NewObject = new Student(); ((Student)e.NewObject).evtIsSavable += new IsSavableHandler(s_evtIsSavable); }
void BindingList_AddingNew (object sender, AddingNewEventArgs e) { e.NewObject = new Customer ("List"); }
private void InParametersentitiesBindingSource_AddingNew(object sender, AddingNewEventArgs e) { EntityStructure x = new EntityStructure(); e.NewObject = x; }
protected override void OnAddingNew(AddingNewEventArgs e) { e.NewObject = new TaskServer(this); base.OnAddingNew(e); }
private void bindingSource1_AddingNew(object sender, AddingNewEventArgs e) { }
public void AddingNew_Handler(object sender, AddingNewEventArgs e) { e.NewObject = new Person(_textbox1.Text, _textbox2.Text, _textbox3.Text, ConvertRadioButtonToGender(), _dateTimePicker.Value); }
/// <summary> /// 添加新数据设置默认值 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tCB_DEPTSTANDARDBindingSource_AddingNew(object sender, AddingNewEventArgs e) { dstNDD_Word.NDD_WORD.WORDIDColumn.DefaultValue = Guid.NewGuid().ToString(); }
private void Variants_AddingNew(object sender, AddingNewEventArgs e) { e.NewObject = new Variante(); }
protected override void OnAddingNew(AddingNewEventArgs e) { Invoke((Action <AddingNewEventArgs>)base.OnAddingNew, e); }
protected override void OnAddingNew(AddingNewEventArgs e) { // BindingList<T> возможно ошибка: EndNew вызывается дважды вместо одного раза _addingNew = 2; base.OnAddingNew(e); }
private void infoLecteurBindingSource_AddingNew(object sender, AddingNewEventArgs e) { e.NewObject = new InfoLecteur(); }
private void BdsWarehouseIODetailAddingNew(object sender, AddingNewEventArgs e) { }
/// <summary> /// Gets called when user is added to the DataGridView /// </summary> /// <param name="sender">Object which triggered the event</param> /// <param name="e">Parameters of the Event</param> private void BindingSource_AddingNew(object sender, AddingNewEventArgs e) { Logger.debug("Adding user to data source.", origin: "ChatMail.AdminView"); e.NewObject = new User(); }
void BaseAddingNew(AddingNewEventArgs e) { base.OnAddingNew(e); }
private void phieuthuBindingSource_AddingNew(object sender, AddingNewEventArgs e) { this.lblPTNgayLap.Text = string.Format("Ngày {0} tháng {1} năm {2}", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year); this.txtPTHoTen.Focus(); }