private void Save() { CStringSerializer ser = new CStringSerializer(ModeSerialisation.Ecriture); if (ser.TraiteListe <CReferenceObjetDonneeAvecLibelle>(m_listeObjets)) { C2iRegistre.SetValueInRegistreApplication("Preferences", "UserMemo", ser.String); } }
//--------------------------------- 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; } } }
//------------------------------------------------ private void SaveStateInRegistre() { if (m_strPreserveStateKey != null && m_strPreserveStateKey.Length > 0) { CStringSerializer serializer = new CStringSerializer(ModeSerialisation.Ecriture); CResultAErreur result = SerializeState(serializer); string strVal = serializer.String; if (!result) { strVal = ""; } C2iRegistre.SetValueInRegistreApplication(c_strCleRegistre, m_strPreserveStateKey, strVal); } }
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); }
static void Main() { //Test Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CFinalCustomerInformations.Init(); SystemEvents.SessionEnding += SystemEvents_SessionEnding; Thread thSplash = new Thread(new ThreadStart(SplashScreen)); thSplash.Start(); //new CFormPoissonAvril().ShowDialog(); #if DEBUG Thread.Sleep(10000); //CRecepteurNotification recepteur = new CRecepteurNotification(-1, typeof(CDonneeNotificationServeurStarted)); //recepteur.OnReceiveNotification += new NotificationEventHandler(recepteur_OnReceiveNotification); //Application.Run(); #endif System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false; CTraducteur.ReadFichier("timos.mes"); //System.Threading.Thread.CurrentThread.ApartmentState = System.Threading.ApartmentState.STA; CServicePopupProgressionTimos serviceIndicateur = new CServicePopupProgressionTimos(); IIndicateurProgression indicateur = null;/* = serviceIndicateur.GetNewIndicateurAndPopup(); * indicateur.SetInfo("Démarrage");*/ #if DEBUG #else try { #endif AppDomain.CurrentDomain.Load("futurocom.win32.sig"); AppDomain.CurrentDomain.Load("futurocom.win32.chart"); AppDomain.CurrentDomain.Load("data.hotel.easyquery"); AppDomain.CurrentDomain.Load("data.hotel.easyquery.win32"); CTimosAppRegistre timosRegistre = new CTimosAppRegistre(); CResultAErreur result = timos.client.CInitialiseurClientTimos.InitClientTimos(timosRegistre, true, indicateur); /*GC.Collect(); * GC.WaitForPendingFinalizers(); * long nMemo = GC.GetTotalMemory(true); * DateTime dtChrono = DateTime.Now; * //for (int n = 0; n < 10000; n++) * { * using (CContexteDonnee ctx = new CContexteDonnee(0, true, false)) * { * for (int n = 0; n < 10000; n++) * { * using (CContexteDonnee ctx2 = ctx.GetContexteEdition()) * { * CTypeAlarme tp = new CTypeAlarme(ctx2); * tp.ReadIfExists(129); * } * } * } * } * GC.Collect(); * GC.WaitForPendingFinalizers(); * long nMemo2 = GC.GetTotalMemory(true); * System.Threading.Thread.Sleep(10000); * TimeSpan sp = DateTime.Now - dtChrono; * Console.WriteLine("TEST : " + sp.TotalMilliseconds);*/ //serviceIndicateur.EndIndicateur(indicateur); if (!result) { thSplash.Abort(); result.EmpileErreur(I.T("Error while opening application|1219")); CFormAlerte.Afficher(result.Erreur, EFormAlerteBoutons.Ok, EFormAlerteType.Exclamation); } else { CSc2iWin32DataClient.Init(CFournisseurContexteDonnee.GetInstance()); CReferenceObjetDonnee.SetFournisseurContexteDonnee(CFournisseurContexteDonnee.GetInstance()); //Effet Fondu CEffetFonduPourFormManager.EffetActif = timosRegistre.OptionsGraphiques_FonduActif; if (AuthentifierUtilisateur(thSplash)) { string strVersionServeur = CTimosApp.SessionClient.SessionSurServeur.GetVersionServeur(); string strVersionClient = Assembly.GetExecutingAssembly().GetName().Version.ToString(); if (strVersionClient != strVersionServeur) { result.EmpileErreur(I.T("Server (@2) and client (@1) version doesn't match. Please, update your Timos client version|20144", strVersionClient, strVersionServeur)); CFormAlerte.Afficher(result.Erreur); CTimosApp.SessionClient.CloseSession(); return; } //Si le profil affecté n'est pas le même que le profil demandé //pour l'utilisateur, affiche une boite de message indiquant //la différence de profil CDonneesActeurUtilisateur user = CUtilSession.GetUserForSession(CSc2iWin32DataClient.ContexteCourant); if (user != null && user.IdProfilLicence.Length != 0) { CInfoLicenceUserProfil profil = (CInfoLicenceUserProfil)CTimosApp.SessionClient.GetPropriete(CInfoLicenceUserProfil.c_nomIdentification); if (profil != null && profil.Id != user.IdProfilLicence) { CFormAlerte.Afficher(I.T("You are connected as @1|20023", profil.Nom), EFormAlerteType.Info); } } bool bRestart = true; foreach (Assembly ass in CGestionnaireAssemblies.GetAssemblies()) { CGestionnaireExtendeurFormEditionStandard.RegisterExtendersInAssembly(ass); } C2iRegistre.InitRegistreApplication(new CTimosAppRegistre()); #if DEBUG //ImporterChamps(); CRelationBesoin_Satisfaction.InitCachePourUnClientJamaisCotéServeur(); string str = ""; foreach (RelationTypeIdAttribute r in CContexteDonnee.RelationsTypeIds) { str += r.TableFille; str += "\t"; str += r.ChampType; str += Environment.NewLine; } Application.Run(new CFormMain()); #else while (bRestart) { bRestart = false; try { Application.Run(new CFormMain()); } catch (Exception e) { result = CResultAErreur.True; result.EmpileErreur(new CErreurException(e)); CFormAfficheErreur.Show(result.Erreur); bRestart = true; } } #endif } } #if DEBUG #else } catch (Exception ex) { StringBuilder bl = new StringBuilder(); ReflectionTypeLoadException lex = ex as System.Reflection.ReflectionTypeLoadException; if (lex != null) { foreach (Exception ee in lex.LoaderExceptions) { bl.Append(ee.Message.ToString()); bl.Append("\r\n"); } } else { bl.Append(ex.Message.ToString( )); } CFormAlerte.Afficher(bl.ToString()); } #endif }
//--------------------------------- public void SavePreference() { C2iRegistre.SetValueInRegistreApplication("Preferences\\AutoHide", RegistreKey, AutoHide ? "1" : "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(); } }