private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { TB_exist.Text = ""; BT_ShowDico.Enabled = false; StopGetFunc = true; CLB_FonctionsAuteur.ClearSelected(); for (int i = 0; i < CLB_FonctionsAuteur.Items.Count; i++) { CLB_FonctionsAuteur.SetItemCheckState(i, CheckState.Unchecked); } StopGetFunc = false; CLB_FonctionsAuteur.Enabled = false; if (listBox1.SelectedIndex >= 0) { string current_name = listBox1.Items[listBox1.SelectedIndex].ToString(); CLB_FonctionsAuteur.Enabled = true; GetFunctions(current_name); listBox2.Items.Clear(); TB_IdxAuteur.Text = listBox1.SelectedIndex.ToString(); if (CBX_CheckDico.Checked) { CheckInDicoAuteurs(current_name); } } }
private void GetFunctions(string current_name) { StopGetFunc = true; ListBox LBActive = LB_AutFunc; ListBox LBActiveComp = LB_AutFuncComp; if (ncf != null) { LBActive = ncf.LB_AutFunc; LBActiveComp = ncf.LB_AutFuncComp; } //on cherche les fonctions deja attribuées; foreach (string s in LBActive.Items) { int idx = -1; string strFunc = string.Empty; if (s == current_name) { idx = LBActive.Items.IndexOf(s); } if (idx >= 0) { strFunc = LBActiveComp.Items[idx].ToString(); } if (strFunc != "") { foreach (string code in strFunc.Split(',')) { if (code != "") { CLB_FonctionsAuteur.SetItemCheckState(CLB_FonctionsAuteur.Items.IndexOf(DFuncAut[code]), CheckState.Checked); } } } } StopGetFunc = false; }