private void cbConType_SelectedIndexChanged(object sender, EventArgs e) { switch (cbConType.SelectedItem) { case "Prefix Only": cbConType.SelectedIndex = 0; LblCon1.Text = "Prefix:"; TxtCon1.Text = ""; LblCon1.Show(); TxtCon1.Show(); LblCon2.Hide(); TxtCon2.Hide(); BtnConSave.Show(); break; case "Suffix Only": cbConType.SelectedIndex = 1; LblCon1.Text = "Suffix:"; TxtCon1.Text = ""; LblCon1.Show(); TxtCon1.Show(); LblCon2.Hide(); TxtCon2.Hide(); BtnConSave.Show(); break; case "Prefix and Suffix": cbConType.SelectedIndex = 2; LblCon1.Text = "Prefix:"; TxtCon1.Text = ""; LblCon2.Text = "Suffix:"; TxtCon2.Text = ""; LblCon1.Show(); TxtCon1.Show(); LblCon2.Show(); TxtCon2.Show(); BtnConSave.Show(); break; case "Specific Callsign": cbConType.SelectedIndex = 3; LblCon1.Text = "Callsign:"; TxtCon1.Text = ""; LblCon1.Show(); TxtCon1.Show(); LblCon2.Hide(); TxtCon2.Hide(); BtnConSave.Show(); break; default: BtnConSave.Hide(); break; } }
private void lvConditions_SelectedIndexChanged(object sender, EventArgs e) { if (lvConditions.SelectedItems.Count > 0) { int conid = (int)lvConditions.SelectedItems[0].Tag; Condition con = Condition.Find((Position)lvPositions.SelectedItems[0].Tag, conid); TxtConName.Text = con.strName; if (con is PreCondition) { PreCondition pcon = (PreCondition)con; cbConType.SelectedIndex = 0; LblCon1.Text = "Prefix:"; TxtCon1.Text = pcon.strPre; LblCon2.Hide(); TxtCon2.Hide(); } else if (con is SufCondition) { SufCondition scon = (SufCondition)con; cbConType.SelectedIndex = 1; LblCon1.Text = "Suffix:"; TxtCon1.Text = scon.strSuf; LblCon2.Hide(); TxtCon2.Hide(); } else if (con is PreSufCondition) { PreSufCondition pscon = (PreSufCondition)con; cbConType.SelectedIndex = 2; LblCon1.Text = "Prefix:"; TxtCon1.Text = pscon.strPre; LblCon2.Text = "Suffix:"; TxtCon2.Text = pscon.strSuf; LblCon2.Show(); TxtCon2.Show(); } else if (con is CsCondition) { CsCondition cscon = (CsCondition)con; cbConType.SelectedIndex = 3; LblCon1.Text = "Callsign:"; TxtCon1.Text = cscon.strCs; LblCon2.Hide(); TxtCon2.Hide(); } else { cbConType.SelectedIndex = -1; LblCon1.Hide(); TxtCon1.Hide(); LblCon2.Hide(); TxtCon2.Hide(); BtnConSave.Hide(); } tlpConditions.Show(); } else { tlpConditions.Hide(); } }