Ejemplo n.º 1
0
        static void Main()
        {
            Ref.InitVars();

            FileManager.InitDirs();
            FileManager.InitFiles();
            Debug.InitLogs();

            Debug.Log($"STARTING application[name = {Ref.APP_NAME}, version = \" {Ref.APP_VER} \"] ::");

            Debug.Log("Application.EnableVisualStyles()");
            Application.EnableVisualStyles();
            Debug.Log("success");

            Debug.Log("Application.SetCompatibleTextRenderingDefault(false)");
            Application.SetCompatibleTextRenderingDefault(false);
            Debug.Log("success");

            Debug.Log("INIT...");

            Debug.Log("Objects...");
            mf      = new MainForm();
            mf.Text = Ref.APP_NAME + " - " + Ref.APP_VER;
            Debug.Log("OK");

            Debug.Log("Delegates...");
            DataCore.onSaveStart += mf.SetStateToSaving;
            DataCore.onSaveStop  += mf.SetStateToSaved;
            Debug.Log("OK");

            Debug.Log("INIT end");


            Debug.Log("Loading lists...");
            DataCore.LoadLists();

            Debug.Log("Application.Run(new MainForm())");

            try
            {
                Application.Run(mf);
                Debug.Log("START finish with success result.");
            }
            catch (Exception e)
            {
                Debug.MsgErr("ERREUR IRRECUPERABLE !", "Ax55", e);
                DataCore.SaveLists();
                Debug.Log("ERREUR.");
                Application.Exit();
            }

            Debug.Log("Saving lists...");
            DataCore.SaveLists();

            Debug.Log("Application stopping...");

            Debug.Log("Closing opened forms...");
            foreach (Form form in Application.OpenForms)
            {
                form.Close();
            }

            Debug.Log("application STOPED.");
        }