private void button1_Click(object sender, EventArgs e) { if (listViewTargetVersionCases.SelectedIndices.Count == 1) { TargetVersionPart part = Phpbb.ModTeam.Tools.Mod.TargetVersionPartParse(comboBox1.Text); switch (part) { case TargetVersionPart.Release: if (textBox1.Text.Length > 1 || !Regex.IsMatch(textBox1.Text, "^([A-Za-z]*)$")) { MessageBox.Show("Release character must be A-Z", "Invalid Release Version Part"); return; } break; default: if (!Regex.IsMatch(textBox1.Text, "^([0-9]+)")) { MessageBox.Show(part.ToString() + " must be a number", "Invalid " + part.ToString() + " Version Part"); return; } break; } int selectedIndex = listViewTargetVersionCases.SelectedIndices[0]; listViewTargetVersionCases.Items[selectedIndex].SubItems[0].Text = comboBox1.Text; listViewTargetVersionCases.Items[selectedIndex].SubItems[1].Text = comboBox2.Text; if (part == TargetVersionPart.Revision) { if (comboBox3.Text == VersionStage.Stable.ToString()) { listViewTargetVersionCases.Items[selectedIndex].SubItems[2].Text = textBox1.Text; } else { listViewTargetVersionCases.Items[selectedIndex].SubItems[2].Text = comboBox3.Text + " " + textBox1.Text; } } else { listViewTargetVersionCases.Items[selectedIndex].SubItems[2].Text = textBox1.Text; } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { TargetVersionPart part = Phpbb.ModTeam.Tools.Mod.TargetVersionPartParse(comboBox1.Text); switch (part) { case TargetVersionPart.Release: if (textBox1.Text.Length > 1 || !Regex.IsMatch(textBox1.Text, "^([A-Za-z]*)$")) { MessageBox.Show("Release character must be A-Z", "Invalid Release Version Part"); return; } break; default: if (!Regex.IsMatch(textBox1.Text, "^([0-9]+)")) { MessageBox.Show(part.ToString() + " must be a number", "Invalid " + part.ToString() + " Version Part"); return; } break; } string textBoxValue = ""; if (part == TargetVersionPart.Revision) { if (comboBox3.Text == VersionStage.Stable.ToString()) { textBoxValue = textBox1.Text; } else { textBoxValue = comboBox3.Text + " " + textBox1.Text; } } else { textBoxValue = textBox1.Text; } string[] tempItem = { comboBox1.Text, comboBox2.Text, textBoxValue }; listViewTargetVersionCases.Items.Add(new ListViewItem(tempItem)); }