/// /////////////////////////////////////////////////////////////////// public static CFournisseurContexteDonnee GetInstance() { if (m_instance == null) { m_instance = new CFournisseurContexteDonnee(); } return(m_instance); }
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 }