public static IControleEditeMapItem GetNewControle(IMapItemGenerator item) { if (item == null) { return(null); } Type tp = null; if (m_dicTypeToTypeControle.TryGetValue(item.GetType(), out tp)) { IControleEditeMapItem ctrl = Activator.CreateInstance(tp, new object[0]) as IControleEditeMapItem; return(ctrl); } return(null); }
//-------------------------------------------------------------------------- private void EditeItemGenerator(IMapItemGenerator generator) { try { m_panelEditeGenerator.SuspendDrawing(); m_panelCopierColler.Visible = false; if (m_editeurActif != null) { m_editeurActif.MajChamps(); UpdateItemsGenerator(); } m_editeurActif = null; foreach (Control ctrlToHide in m_panelEditeGenerator.Controls) { ctrlToHide.Visible = false; } if (generator == null) { return; } IControleEditeMapItem ctrl = null; if (!m_dicControlesAlloues.TryGetValue(generator.GetType(), out ctrl)) { ctrl = CAllocateurInterfaceMapItemGenerator.GetNewControle(generator); if (ctrl != null) { CWin32Traducteur.Translate(ctrl); m_panelEditeGenerator.Controls.Add(ctrl as Control); ((Control)ctrl).Dock = DockStyle.Fill; m_dicControlesAlloues.Add(generator.GetType(), ctrl); } } if (ctrl != null) { m_panelCopierColler.Visible = true; ((Control)ctrl).Visible = true; ((IControlALockEdition)ctrl).LockEdition = LockEdition; ctrl.InitChamps(generator); m_editeurActif = ctrl; } } finally { m_panelEditeGenerator.ResumeDrawing(); } }
//---------------------------------------------------------- public void InitChamps(CMapDatabaseGenerator generator) { m_mapDatabaseGenerator = generator; if (m_mapDatabaseGenerator == null) { m_tabControl.Visible = false; return; } m_tabControl.Visible = true; m_panelFormulaire.Init(typeof(CMapDatabaseGenerator), m_mapDatabaseGenerator, m_mapDatabaseGenerator.Formulaire, m_mapDatabaseGenerator); m_editeurActif = null; foreach (Control ctrl in m_panelEditeGenerator.Controls) { ctrl.Visible = false; } m_selectTypeSource.TypeSelectionne = generator.TypeSource; FillListeGenerators(); RefillListeVariables(); }