private void Person_AddItemEvent(object sender, DevKotCollectionEventArgs e) { if (e.itemcontent.GetType() == typeof(Person)) { textBox1.Text = ((Person)e.itemcontent).Adress + " " + ((Person)e.itemcontent).ZipCode.ToString(); } }
public void Add(T item) { DevKotCollectionEventArgs devEventArgs = new DevKotCollectionEventArgs(); _list.Add(item); devEventArgs.SetEventArgs <T>(item, "Rene"); OnAddItemEvent(devEventArgs); }
protected virtual void OnAddItemEvent(DevKotCollectionEventArgs e) { EventHandler <DevKotCollectionEventArgs> handler = AddItemEvent; if (handler != null) { handler(this, e); } }
private void Devcol_AddItemEvent(object sender, DevKotCollectionEventArgs e) { textBox1.Text = e.itemcontent.ToString(); textBox1.Text += " " + e.username; textBox1.Text = DSharp.FrameWork.ContactGenerator.SimpleGenerator.PhoneNumber(DSharp.FrameWork.ContactGenerator.Language.US); textBox1.Text = DSharp.FrameWork.ContactGenerator.SimpleGenerator.AccountNumber(DSharp.FrameWork.ContactGenerator.Language.US); DSharp.FrameWork.ContactGenerator.Generator gen = new DSharp.FrameWork.ContactGenerator.Generator(); gen.Settings.Language = DSharp.FrameWork.ContactGenerator.Language.US; gen.RecordDefinition.AddStreet(); gen.RecordDefinition.AddGender(); gen.RecordDefinition.AddFirstName(); gen.RecordDefinition.AddLastName(); gen.RecordDefinition.AddPhoneNumber(); gen.RecordDefinition.AddEmail(); gen.RecordDefinition.AddUsername(); gen.RecordDefinition.AddZipcode(); gen.RecordDefinition.AddBirthDay(); gen.ExportOptions.Type = DSharp.FrameWork.ContactGenerator.ExportType.XML; gen.Settings.Language = Language.US; gen.ExportOptions.ListName = "Personen"; gen.ExportOptions.ElementName = "Person"; // gen.Generate(50); //gen.Export("Personen.xml"); Personen cars = null; Person.ItemChanged += Person_ChangeItemEvent; string path = "Personen.xml"; XmlSerializer serializer = new XmlSerializer(typeof(Personen)); StreamReader reader = new StreamReader(path); cars = (Personen)serializer.Deserialize(reader); reader.Close(); BindingSource source = new BindingSource(); source.DataSource = cars.Person.ToList <Person>(); listBox1.DisplayMember = "FirstName"; listBox1.DataSource = source; // textBox2.DataBindings.Add(new Binding("Text", cars.Person, "FirstName")); textBox2.DataBindings.Add("Text", source, "FirstName", true, DataSourceUpdateMode.OnPropertyChanged); foreach (Person p in cars.Person) { //listBox1.Items.Add(p); } cars.Person.AddItemEvent += Person_AddItemEvent; cars.Person.Add(new Person() { FirstName = "Claudia Cartis", Adress = "Attemsgasse Theodor Krammerstrasse", ZipCode = "1220" }); cars.Person.ChangeItemEvent += Person_ChangeItemEvent; cars.Person[cars.Person.Count - 1].FirstName = "dgfgfgfg"; }
private void Person_ChangeItemEvent(object sender, DevKotCollectionEventArgs e) { textBox1.Text = e.itemcontent.ToString() + " " + e.username; }