private void button1_Click(object sender, EventArgs e) { List <String> tmp = new List <String>(); for (int row = 0; row < dataGridView1.Rows.Count; row++) { try { tmp.Add(dataGridView1.Rows[row].Cells[1].Value.ToString()); } catch { } } List <string> vals = new List <string>(); foreach (string s in tmp) { if (vals.Contains(s)) { MessageBox.Show(T("There must be no duplicated names!")); //Названия не должны повторяться! return; } vals.Add(s); } SiteManagerClass.LoadFromGrid(dataGridView1); SiteManagerClass.SaveToSettings(); this.Close(); }
public void SaveSettings() { Options.SetOption("skip_null", skip_null.Checked ? 1 : 0); Options.SetOption("check_updates", check_updates.Checked ? 1 : 0); Options.SetOption("check_links", check_links.Checked ? 1 : 0); Options.SetOption("buff1", buff1.Text); Options.SetOption("buff2", buff2.Text); Options.SetOption("buff3", buff3.Text); Options.SetOption("recent_count", recent_count.Text); if (applyonlytotheproject1.Checked) { SiteManagerClass.review_summaries[SiteManagerClass.current] = rw_comm.Text; } else { Options.SetOption("rw_comm", rw_comm.Text); SiteManagerClass.review_summaries[SiteManagerClass.current] = ""; } if (applyonlytotheproject2.Checked) { SiteManagerClass.rollback_summaries[SiteManagerClass.current] = rj_comm.Text; } else { Options.SetOption("rj_comm", rj_comm.Text); SiteManagerClass.rollback_summaries[SiteManagerClass.current] = ""; } SiteManagerClass.SaveToSettings(); Options.SetOption("pd_wait", pd_wait.Text); Options.SetOption("diff_style", diff_style.SelectedIndex == 0 ? "" : "_old"); Options.SetOption("scroll_diff", auto_scroll.Checked ? 1 : 0); Options.SaveOptions(); }