void addFactorToolStripMenuItem_Click(object sender, EventArgs e) { try { int n = arrSmp[0].GetLength(); string mark = string.Format("x<SUB>{0}</SUB>", arrSmp.Length + 1); Sample smp = new Sample("Новый признак", mark, new double[n]); FactorForm fForm = new FactorForm(smp, "Нет"); if (fForm.ShowDialog() != DialogResult.OK) { return; } Sample[] arrSmpNew = new Sample[arrSmp.Length + 1]; arrSmp.CopyTo(arrSmpNew, 0); arrSmpNew[arrSmp.Length] = fForm.GetSample(); arrSmpNew[arrSmp.Length].DoHistogram(useSturgess); arrSmp = arrSmpNew; TranSample[] arrTranSmpNew = new TranSample[arrSmp.Length]; arrTranSmp.CopyTo(arrTranSmpNew, 0); TranSample ts = fForm.GetTranSample(); ts.DoHistogram(useSturgess); arrTranSmpNew[arrTranSmp.Length] = ts; arrTranSmp = arrTranSmpNew; lvSample.Items.Add(new ListViewItem(new string[] { ts.GetName(), ts.GetTransform() })); } catch { } }
void editFactorToolStripMenuItem_Click(object sender, EventArgs e) { try { int index = lvSample.SelectedIndices[0]; string transform = lvSample.Items[index].SubItems[1].Text; FactorForm fForm = new FactorForm(arrSmp[index], transform); if (fForm.ShowDialog() != DialogResult.OK) { return; } arrSmp[index] = fForm.GetSample(); TranSample ts = fForm.GetTranSample(); ts.DoHistogram(useSturgess); arrTranSmp[index] = ts; lvSample.Items[index].SubItems[0].Text = arrSmp[index].GetName(); lvSample.Items[index].SubItems[1].Text = ts.GetTransform(); } catch { } }