private void CFormEditVariableFiltreCalculee_Load(object sender, System.EventArgs e)
        {
            // Lance la traduction du formulaire
            sc2i.win32.common.CWin32Traducteur.Translate(this);

            CRoleChampCustom role = CRoleChampCustom.GetRoleForType(m_typeDonnees);

            if (role != null)
            {
                CListeObjetsDonnees listeChamps = CChampCustom.GetListeChampsForRole(CSc2iWin32DataClient.ContexteCourant, role.CodeRole);
                listeChamps.Tri = CChampCustom.c_champNom;
                m_wndListeChamps.ListeSource = listeChamps;

                Dictionary <int, bool> lstChecks = new Dictionary <int, bool>();
                if (!(m_champ.Origine is C2iOrigineChampExportChampCustom))
                {
                    m_champ.Origine = new C2iOrigineChampExportChampCustom();
                }
                m_champ.NomChamp = "CUSTOM_FIELDS";
                C2iOrigineChampExportChampCustom origineChamp = (C2iOrigineChampExportChampCustom)m_champ.Origine;
                foreach (int nId in origineChamp.IdsChampCustom)
                {
                    lstChecks[nId] = true;
                }
                for (int nChamp = 0; nChamp < listeChamps.Count; nChamp++)
                {
                    CChampCustom champ = (CChampCustom)listeChamps[nChamp];
                    if (lstChecks.ContainsKey(champ.Id))
                    {
                        m_wndListeChamps.CheckItem(nChamp);
                    }
                }
            }
        }
        private void m_btnOk_Click(object sender, EventArgs e)
        {
            if (!(m_wndListeChamps.ListeSource is CListeObjetsDonnees))
            {
                return;
            }
            CListeObjetsDonnees listeChamps = (CListeObjetsDonnees)m_wndListeChamps.ListeSource;
            List <int>          nIdsChecked = new List <int>();

            foreach (CChampCustom champ in m_wndListeChamps.CheckedItems)
            {
                nIdsChecked.Add(champ.Id);
            }
            C2iOrigineChampExportChampCustom origine = new C2iOrigineChampExportChampCustom(nIdsChecked.ToArray());

            m_champ.Origine  = origine;
            m_champ.NomChamp = "CUSTOM_FIELDS";

            DialogResult = DialogResult.OK;
            Close();
        }