private void button1_Click(object sender, System.EventArgs e) { try { string [] stats = textBox1.Text.Split(",".ToCharArray()); if (radioButton1.Checked) { co.ResetStatistics(stats); } else if (radioButton3.Checked) { string [] vals = textBox2.Text.Split(",".ToCharArray()); if (vals.Length != stats.Length) { MessageBox.Show("The number of statistics does not match the number of values."); return; } Statistic [] statistics = new Statistic[stats.Length]; for (int i = 0; i < stats.Length; i++) { statistics[i] = new Statistic(stats[i], vals[i]); } co.UpdateStatistics(statistics); } RetrieveStatistics(stats); } catch (Exception ae) { ShowException(ae); } }
private void button1_Click(object sender, System.EventArgs e) { try { string [] stats = textBox1.Text.Split(",".ToCharArray()); if (radioButton1.Checked) { co.ResetStatistics(stats); } else if (radioButton3.Checked) { string [] vals = textBox2.Text.Split(",".ToCharArray()); if (vals.Length != stats.Length) { MessageBoxOptions options = new MessageBoxOptions(); if (CultureInfo.CurrentCulture.TextInfo.IsRightToLeft) { options |= MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading; } MessageBox.Show("The number of statistics does not match the number of values.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, options); return; } Statistic [] statistics = new Statistic[stats.Length]; for (int i = 0; i < stats.Length; i++) { statistics[i] = new Statistic(stats[i], vals[i]); } co.UpdateStatistics(statistics); } RetrieveStatistics(stats); } catch (Exception ae) { ShowException(ae); } }