private void frm_chipeditorsettings_Updated(object sender, NewChipSettingsUpdateEventArgs e) { NumCol = e.NumCol; NumSpots = e.NumSpots; NumMeanSpots = e.NumMeanSpots; MeanMethod = e.MeanMethod; dt_spots = CreateEmptyChipTable(NumCol, NumSpots); dgw_spots.DataSource = dt_spots; dt_list = CreateEmptyChipList(NumSpots / NumMeanSpots); dgw_spotlist.DataSource = dt_list; foreach (DataGridViewColumn dgc in dgw_spots.Columns) { dgc.SortMode = DataGridViewColumnSortMode.NotSortable; } foreach (DataGridViewRow row in dgw_spots.Rows) { row.HeaderCell.Value = String.Format("{0}", row.Index + 1); } foreach (DataGridViewColumn dgc in dgw_spotlist.Columns) { dgc.SortMode = DataGridViewColumnSortMode.NotSortable; } this.IsModified = true; }
private void btn_ok_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.None; if (tabControl1.SelectedTab.Text == "Advanced") { if (tb_numspots.Text.Length == 0 || tb_columns.Text.Length == 0 || tb_numspotsmean.Text.Length == 0) { MessageBox.Show("Please fill all fields.", "Error", MessageBoxButtons.OK); } else if (tb_numspots.Text.Length > 0 && tb_columns.Text.Length > 0) { if ((Convert.ToInt32(tb_numspots.Text) % (Convert.ToInt32(tb_columns.Text))) > 0) { MessageBox.Show("The number of spots doesn't match with the number of columns.", "Error", MessageBoxButtons.OK); } } else { string mm; if (rbtn_uk.Checked == true) { mm = "UK"; } else { mm = "DE"; } NewChipSettingsUpdateEventArgs args = new NewChipSettingsUpdateEventArgs( Convert.ToInt32(tb_numspots.Text), Convert.ToInt32(tb_columns.Text), Convert.ToInt32(tb_numspotsmean.Text), mm ); NewChipSettingsUpdated(this, args); this.DialogResult = DialogResult.OK; } } else { string mm; switch (cmb_chiptype.SelectedIndex) { case 0: //IR tb_numspots.Text = "156"; tb_columns.Text = "13"; mm = "UK"; break; case 1: //RA(UK) tb_numspots.Text = "156"; tb_columns.Text = "13"; mm = "UK"; break; case 2: //RA(DE) tb_numspots.Text = "156"; tb_columns.Text = "12"; mm = "DE"; break; case 3: //SLE(DE) tb_numspots.Text = "156"; tb_columns.Text = "12"; mm = "DE"; break; default: tb_numspots.Text = "156"; tb_columns.Text = "13"; mm = "UK"; break; } tb_numspotsmean.Text = "3"; NewChipSettingsUpdateEventArgs args = new NewChipSettingsUpdateEventArgs( Convert.ToInt32(tb_numspots.Text), Convert.ToInt32(tb_columns.Text), Convert.ToInt32(tb_numspotsmean.Text), mm ); NewChipSettingsUpdated(this, args); this.DialogResult = DialogResult.OK; } if (this.DialogResult == DialogResult.OK) { this.Close(); } }