private void m_lnkRemove_LinkClicked(object sender, EventArgs e) { if (m_wndListeMacros.SelectedItems.Count == 1) { CMacro macro = m_wndListeMacros.SelectedItems[0].Tag as CMacro; if (macro != null && MessageBox.Show(I.T("#Supprimer la macro @1?", macro.Libelle), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { CListeMacros.RemoveMacro(macro); FillListe(); } } }
//------------------------------------------------ private void m_btnLoad_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "#Macro|*.FutMacro|All files|*.*"; if (dlg.ShowDialog() == DialogResult.OK) { CMacro macro = new CMacro(); macro.ContexteDonnee = CSc2iWin32DataClient.ContexteCourant; CResultAErreur result = CSerializerObjetInFile.ReadFromFile(macro, "MACRO", dlg.FileName); if (!result) { CFormAlerte.Afficher(result.Erreur); } else { CListeMacros.AddMacro(macro); FillListe(); } } }
void item_Click(object sender, EventArgs e) { ToolStripMenuItem item = sender as ToolStripMenuItem; CVersionDonnees version = item != null ? item.Tag as CVersionDonnees : null; if (version != null) { CResultAErreurType <CMacro> res = CMacro.FromVersion(version); bool bAdd = res; if (!res) { if (CFormAlerte.Afficher(res.Erreur) == DialogResult.Ignore) { bAdd = true; } } if (bAdd) { CListeMacros.AddMacro(res.DataType); FillListe(); } } }