private void создатьToolStripMenuItem_Click(object sender, EventArgs e) { double left = 0; double right = 0; double step = 0; ContinuousFuzzySet <double, double> ConSet = null; DiscreteFuzzyStringSet DiscSet = null; Params p = new Params(); if (radioButton2.Checked) { try { if (comboBox1.SelectedIndex == 1 || comboBox1.SelectedIndex == 0) { p.TryParse(textBox5.Text, textBox6.Text); } else if (comboBox1.SelectedIndex == 2) { p.TryParse(textBox5.Text, textBox6.Text, textBox7.Text); } } catch (Exception) { MessageBox.Show("Неверный аргумент!", "Ошибка"); return; } try { Double.TryParse(textBox1.Text, out left); Double.TryParse(textBox2.Text, out right); Double.TryParse(textBox3.Text, out step); } catch (Exception) { MessageBox.Show("Неверный аргумент!", "Ошибка"); return; } ConSet = CreateContinuousSet(left, right, step, p.a, p.b, p.c); ElementsCache.Add(ConSet); } else if (radioButton1.Checked) { string[] src = textBox4.Text.Split(new string[] { " ", ".", ",", ":", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); if (comboBox2.SelectedIndex < 0 && comboBox3.SelectedIndex < 0 && comboBox4.SelectedIndex < 0 && comboBox1.SelectedIndex != 3) { MessageBox.Show("Неверный аргумент!", "Ошибка"); return; } DiscSet = CreateDiscreteStringSet(comboBox2.SelectedIndex, comboBox3.SelectedIndex, comboBox4.SelectedIndex, src); ElementsCache.Add(DiscSet); } listBox1.Items.Add("set #" + ElementsCache.Count.ToString()); }
private void удалитьИзКэшаToolStripMenuItem_Click(object sender, EventArgs e) { int id = listBox1.SelectedIndex; if (id == -1) { return; } ElementsCache.RemoveAt(id); listBox1.Items.RemoveAt(id); }
private void графикToolStripMenuItem_Click(object sender, EventArgs e) { chart1.ResetAutoValues(); int id = listBox1.SelectedIndex; ContinuousFuzzySet <double, double> ConSet = null; DiscreteFuzzyStringSet DiskSet = null; if (ElementsCache.GetAt(id).GetType() == typeof(ContinuousFuzzySet <double, double>)) { ConSet = (ContinuousFuzzySet <double, double>)ElementsCache.GetAt(id); ViewSet(ConSet, chart1); } else if (ElementsCache.GetAt(id).GetType() == typeof(DiscreteFuzzyStringSet)) { DiskSet = (DiscreteFuzzyStringSet)ElementsCache.GetAt(id); ViewSet(DiskSet, chart1); } }
private void очиститьКэшToolStripMenuItem_Click(object sender, EventArgs e) { ElementsCache.Clear(); listBox1.Items.Clear(); }