Exemple #1
0
        //---------------------------------
        public void ReadPreference()
        {
            string strVal = C2iRegistre.GetValueInRegistreApplication("Preferences\\AutoHide", RegistreKey, "NONE");

            if (strVal != "NONE")
            {
                AutoHide = strVal == "1";
            }
        }
        public void Read()
        {
            string strValue = C2iRegistre.GetValueInRegistreApplication("Preferences", "UserMemo", "");

            if (strValue.Trim() != "")
            {
                List <CReferenceObjetDonneeAvecLibelle> lst = new List <CReferenceObjetDonneeAvecLibelle>();
                CStringSerializer ser = new CStringSerializer(strValue, ModeSerialisation.Lecture);
                if (ser.TraiteListe <CReferenceObjetDonneeAvecLibelle>(lst))
                {
                    m_listeObjets = lst;
                }
            }
        }
        public static IEnumerable <CActionCopierMultiLocalDansGed.CInfoFichierToGed> GetInfosToAdd(
            IEnumerable <int> lstIdsCategories)
        {
            using (CFormAddMultipleToGed frm = new CFormAddMultipleToGed())
            {
                List <CCategorieGED> lstCats       = new List <CCategorieGED>();
                StringBuilder        blKeyMultiEDM = new StringBuilder();
                if (lstIdsCategories != null)
                {
                    foreach (int nId in lstIdsCategories)
                    {
                        CCategorieGED categorie = new CCategorieGED(CSc2iWin32DataClient.ContexteCourant);
                        if (categorie.ReadIfExists(nId))
                        {
                            lstCats.Add(categorie);
                            blKeyMultiEDM.Append(nId);
                            blKeyMultiEDM.Append("_");
                        }
                    }
                }
                frm.m_strKeyRepertoire = "MEDOC_" + blKeyMultiEDM.ToString();

                string strRep = C2iRegistre.GetValueInRegistreApplication("Preferences", frm.m_strKeyRepertoire, "");
                if (strRep != "")
                {
                    frm.m_browser.StartUpDirectory      = sc2i.win32.common.folderbrowser.SpecialFolders.Other;
                    frm.m_browser.StartUpDirectoryOther = strRep;
                }
                frm.Init(lstCats);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    strRep = frm.m_browser.CurrentFolderKey;
                    if (strRep != null)
                    {
                        C2iRegistre.SetValueInRegistreApplication("Preferences", frm.m_strKeyRepertoire, strRep);
                    }
                    return(frm.GetInfosToAdd());
                }
            }
            return(null);
        }
Exemple #4
0
        //-----------------------------------------------------------
        public void ApplyConfig(
            CConfigWndMapView config,
            object source)
        {
            m_configAppliquee = config;
            CResultAErreur result = CResultAErreur.True;

            m_objetSource = source;
            CContexteEvaluationExpression contexteEval = new CContexteEvaluationExpression(source);

            if (config.FormuleLatitude != null)
            {
                result = config.FormuleLatitude.Eval(contexteEval);
                if (result && result.Data is double || result.Data is int)
                {
                    CenterLatitude = Convert.ToDouble(result.Data);
                }
            }
            if (config.FormuleLongitude != null)
            {
                result = config.FormuleLongitude.Eval(contexteEval);
                if (result && result.Data is double || result.Data is int)
                {
                    CenterLongitude = Convert.ToDouble(result.Data);
                }
            }
            if (config.FormuleZoomFactor != null)
            {
                result = config.FormuleZoomFactor.Eval(contexteEval);
                if (result && result.Data is double || result.Data is int)
                {
                    Zoom = Convert.ToDouble(result.Data);
                }
            }
            m_strPreserveStateKey = "";
            if (config.FormulePreserveStateKey != null)
            {
                result = config.FormulePreserveStateKey.Eval(contexteEval);
                if (result && result.Data != null)
                {
                    m_strPreserveStateKey = result.Data.ToString();
                }
            }

            foreach (CConfigCalqueMap calqueConf in config.ConfigsCalques)
            {
                CRuntimeConfigMapView runtime = null;
                //TESTDBKEYOK
                m_dicRuntimes.TryGetValue(calqueConf.KeyConfigMapDatabase, out runtime);
                if (runtime == null)
                {
                    runtime = new CRuntimeConfigMapView();
                    //TESTDBKEYOK
                    runtime.KeyConfigMapDatabase = calqueConf.KeyConfigMapDatabase;
                }
                if (runtime.Generator == null)
                {
                    CConfigMapDatabase configInDb = new CConfigMapDatabase(CContexteDonneeSysteme.GetInstance());
                    //TESTDBKEYOK
                    if (!configInDb.ReadIfExists(calqueConf.KeyConfigMapDatabase))
                    {
                        continue;//bizarre, mais ça peut arriver
                    }
                    runtime.Generator = configInDb.MapGenerator;
                }
                //TESTDBKEYOK
                m_dicRuntimes[runtime.KeyConfigMapDatabase] = runtime;
                runtime.IsVisible = true;
                runtime.Generator.ClearVariables();
                foreach (CFormuleNommee formule in calqueConf.ValeursVariablesFiltre)
                {
                    if (formule.Formule != null)
                    {
                        try
                        {
                            string strVal = formule.Id;
                            // TESTDBKEYOK
                            if (runtime.Generator.GetVariable(strVal) != null)
                            {
                                result = formule.Formule.Eval(contexteEval);
                                if (result)
                                {
                                    runtime.Generator.SetValeurChamp(strVal, result.Data);
                                }
                            }
                        }
                        catch { }
                    }
                }
                runtime.IsCalculated = false;
            }
            if (m_strPreserveStateKey != null && m_configAppliquee != null)
            {
                string strState = C2iRegistre.GetValueInRegistreApplication(c_strCleRegistre, m_strPreserveStateKey, "");
                if (strState != "")
                {
                    CStringSerializer serializer = new CStringSerializer(strState, ModeSerialisation.Lecture);
                    SerializeState(serializer);
                }
            }
            ShowLayers();
            if (config.FormuleLatitude == null || config.FormuleLongitude == null || config.FormuleZoomFactor == null)
            {
                AutoZoomAndCenter();
            }
        }