private void AddItem(object sender, EventArgs e) { List<cClassForVariable> ListVar = new List<cClassForVariable>(); ListVar.Add(new cClassForVariable("v_CellNumber", 100)); ListVar.Add(new cClassForVariable("v_InitPosX", 0)); ListVar.Add(new cClassForVariable("v_InitPosY", 0)); ListVar.Add(new cClassForVariable("v_InitPosZ", 0)); ListVar.Add(new cClassForVariable("v_InitPosType", 0)); ListVar.Add(new cClassForVariable("v_InitVolType", 0)); ListVar.Add(new cClassForVariable("v_InitVol", 10)); cListVariables AssociatedListVar = new cListVariables(ListVar); FormForInfoSingleCellPopInit_Simulator WindowForSingleCellPop = new FormForInfoSingleCellPopInit_Simulator(WorldDims, AssociatedListVar, Parent,null); if (WindowForSingleCellPop.ShowDialog() == System.Windows.Forms.DialogResult.OK) { List<string> names = new List<string>(); names.Add(WindowForSingleCellPop.CellPopulation.Name); names.Add(WindowForSingleCellPop.CellPopulation.Count.ToString()); names.Add(WindowForSingleCellPop.CellPopulation[0].Type.Name); WindowForSingleCellPop.CellPopulation.AssociatedVariables = WindowForSingleCellPop.ListVariables; ListViewItem NewItem = new ListViewItem(names.ToArray()); WindowForSingleCellPop.CellPopulation.Information = WindowForSingleCellPop.richTextBoxDescription.Text; NewItem.Tag = WindowForSingleCellPop.CellPopulation; NewItem.Checked = true; this.listViewForCellPopulations.Items.Add(NewItem); } }
void EditItem(object sender, EventArgs e) { cListAgents SelectedCellPop = (cListAgents)listViewForCellPopulations.FocusedItem.Tag; FormForInfoSingleCellPopInit_Simulator WindowForSingleCellPop = new FormForInfoSingleCellPopInit_Simulator( this.WorldDims,SelectedCellPop.AssociatedVariables, Parent, SelectedCellPop); WindowForSingleCellPop.richTextBoxDescription.Text = SelectedCellPop.Information; if (WindowForSingleCellPop.ShowDialog() == System.Windows.Forms.DialogResult.OK) { List<string> names = new List<string>(); cListAgents returnPop = WindowForSingleCellPop.CellPopulation; listViewForCellPopulations.FocusedItem.SubItems[0].Text = returnPop.Name; listViewForCellPopulations.FocusedItem.SubItems[1].Text = returnPop.Count.ToString(); listViewForCellPopulations.FocusedItem.SubItems[2].Text = returnPop[0].Type.Name; //names.Add(SelectedCellPop.Count.ToString()); // names.Add(WindowForSingleCellPop.CellPopulation[0].Type.Name); returnPop.AssociatedVariables = WindowForSingleCellPop.ListVariables; // ListViewItem NewItem = new ListViewItem(names.ToArray()); listViewForCellPopulations.FocusedItem.Tag = returnPop; // NewItem.Checked = true; //this.listViewForCellPopulations.Items.Add(NewItem); } }