//---------------------------------------------------------- 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(); }
//---------------------------------------------------------- public CResultAErreur Serialize(C2iSerializer serializer) { int nVersion = GetNumVersion(); CResultAErreur result = serializer.TraiteVersion(ref nVersion); if (!result) { return(result); } //TESTDBKEYOK if (nVersion < 1) { serializer.ReadDbKeyFromOldId(ref m_keyConfigMapDatabase, typeof(CConfigMapDatabase)); } else { serializer.TraiteDbKey(ref m_keyConfigMapDatabase); } if (serializer.Mode == ModeSerialisation.Lecture) { CConfigMapDatabase db = new CConfigMapDatabase(CContexteDonneeSysteme.GetInstance()); //TESTDBKEYOK if (!db.ReadIfExists(m_keyConfigMapDatabase)) { m_generator = null; } else { m_generator = db.MapGenerator; } } serializer.TraiteInt(ref m_nZOrder); serializer.TraiteBool(ref m_bIsVisible); List <KeyValuePair <string, object> > valeurs = new List <KeyValuePair <string, object> >(); if (m_generator != null) { foreach (KeyValuePair <string, object> kv in m_generator.ValeursVariables) { if (kv.Value != null && C2iSerializer.GetTypeSimple(kv.Value.GetType()) != C2iSerializer.EnumTypeSimple.Inconnu) { valeurs.Add(kv); } } } int nNbValeurs = valeurs.Count(); serializer.TraiteInt(ref nNbValeurs); switch (serializer.Mode) { case ModeSerialisation.Ecriture: foreach (KeyValuePair <string, object> kv in valeurs) { string strIdVar = kv.Key; object value = kv.Value; //TESTDBKEYOK serializer.TraiteString(ref strIdVar); result = serializer.TraiteObjetSimple(ref value); if (!result) { return(result); } } break; case ModeSerialisation.Lecture: if (m_generator != null) { m_generator.ClearVariables(); } for (int nVar = 0; nVar < nNbValeurs; nVar++) { string strIdVar = ""; object value = null; if (nVersion < 1) { int nIdTemp = -1; serializer.TraiteInt(ref nIdTemp); strIdVar = nIdTemp.ToString(); } else { serializer.TraiteString(ref strIdVar); } result = serializer.TraiteObjetSimple(ref value); if (!result) { return(result); } if (m_generator != null) { m_generator.SetValeurChamp(strIdVar, value); } } break; } return(result); }