private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { Stopwatch st = new Stopwatch(); Stopwatch st2 = new Stopwatch(); st.Start(); st2.Start(); switch (comboBox1.SelectedItem) { case "Критерий Гаврилова": { pictureBox1.Image = BinMethods.Gavr(pic, ref st2); st.Stop(); time.Text = st.Elapsed.TotalSeconds.ToString() + " " + "секунд(ы)"; InTime.Text = st2.Elapsed.TotalSeconds.ToString() + " " + "секунд(ы)"; break; } case "Критерий Отсу": { pictureBox1.Image = BinMethods.Otcu(pic, ref st2); st.Stop(); time.Text = st.Elapsed.TotalSeconds.ToString() + " " + "секунд(ы)"; InTime.Text = st2.Elapsed.TotalSeconds.ToString() + " " + "секунд(ы)"; break; } default: break; } }
private void button3_Click(object sender, EventArgs e) { Stopwatch st = new Stopwatch(); Stopwatch st2 = new Stopwatch(); st.Start(); st2.Start(); if (k.Text != "" && a.Text != "") { pictureBox1.Image = BinMethods.Sayvol(pic, Convert.ToDouble(k.Text), Convert.ToInt32(a.Text), ref st2); } else { pictureBox1.Image = BinMethods.Sayvol(pic, 0.25, 4, ref st2); } st.Stop(); time.Text = st.Elapsed.TotalSeconds.ToString() + " " + "секунд(ы)"; InTime.Text = st2.Elapsed.TotalSeconds.ToString() + " " + "секунд(ы)"; }