private void points_comboBox_SelectedValueChanged(object sender, System.EventArgs e) { if (!bDrawing && thread != null) { thread.Join(); ExamplePoint p = new ExamplePoint(); if (p.FromString(points_comboBox.SelectedItem.ToString())) { xmin = p.xmin; xmax = p.xmax; ymin = p.ymin; ymax = p.ymax; nMax = p.max_iter; if (p.name != null && p.name != "") { Text = "Mandelbrot Viewer - " + p.name; } else { Text = "Mandelbrot Viewer"; } bDrawing = true; ThreadStart threadProc = new ThreadStart(work_thread); thread = new Thread(threadProc); thread.Start(); rBox = new Rectangle(0, 0, 0, 0); outputBox.Invalidate(); } } }
private void demo_button_Click(object sender, System.EventArgs e) { if (demo_list == null) { demo_list = new ArrayList(); } OpenFileDialog dlg = new OpenFileDialog(); dlg.InitialDirectory = "c:\\"; dlg.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; dlg.FilterIndex = 1; dlg.RestoreDirectory = true; if (dlg.ShowDialog() == DialogResult.OK) { using (StreamReader sr = new StreamReader(dlg.OpenFile())) { String line; bool first = true; while ((line = sr.ReadLine()) != null) { line.Trim(); if (line.Length > 0 && line[0] != '#') { ExamplePoint node = new ExamplePoint(); if (node.FromString(line)) { if (first) { demo_list.Clear(); // new list replaces the old first = false; } demo_list.Add(node); } } } sr.Close(); points_comboBox.Items.Clear(); for (int i = 0; i < demo_list.Count; i++) { //MessageBox.Show(((ExamplePoint)demo_list[i]).ToString(), String.Format("demo: {0}", i)); points_comboBox.Items.Add(((ExamplePoint)demo_list[i]).ToString()); } points_comboBox.SelectedIndex = 0; if (connect_button.Enabled == false) { go_stop_button.Enabled = true; } } } }
private void demo_button_Click(object sender, System.EventArgs e) { if (demo_list == null) demo_list = new ArrayList(); OpenFileDialog dlg = new OpenFileDialog(); dlg.InitialDirectory = "c:\\"; dlg.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; dlg.FilterIndex = 1; dlg.RestoreDirectory = true; if(dlg.ShowDialog() == DialogResult.OK) { using (StreamReader sr = new StreamReader(dlg.OpenFile())) { String line; bool first = true; while ((line = sr.ReadLine()) != null) { line.Trim(); if (line.Length > 0 && line[0] != '#') { ExamplePoint node = new ExamplePoint(); if (node.FromString(line)) { if (first) { demo_list.Clear(); // new list replaces the old first = false; } demo_list.Add(node); } } } sr.Close(); points_comboBox.Items.Clear(); for (int i=0; i<demo_list.Count; i++) { //MessageBox.Show(((ExamplePoint)demo_list[i]).ToString(), String.Format("demo: {0}", i)); points_comboBox.Items.Add(((ExamplePoint)demo_list[i]).ToString()); } points_comboBox.SelectedIndex = 0; if (connect_button.Enabled == false) { go_stop_button.Enabled = true; } } } }
private void points_comboBox_SelectedValueChanged(object sender, System.EventArgs e) { if (!bDrawing && thread != null) { thread.Join(); ExamplePoint p = new ExamplePoint(); if (p.FromString(points_comboBox.SelectedItem.ToString())) { xmin = p.xmin; xmax = p.xmax; ymin = p.ymin; ymax = p.ymax; nMax = p.max_iter; if (p.name != null && p.name != "") Text = "Mandelbrot Viewer - " + p.name; else Text = "Mandelbrot Viewer"; bDrawing = true; ThreadStart threadProc = new ThreadStart(work_thread); thread = new Thread(threadProc); thread.Start(); rBox = new Rectangle(0, 0, 0, 0); outputBox.Invalidate(); } } }