Пример #1
0
        static void Main()
        {
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);



            // read configuration file or run configuration form
            Commons.ReadConfigFile();
            if (!System.IO.File.Exists(Commons.PathAndFileDatabase))
            {
                MessageBox.Show("Configurazione del programma.\r\nSistemare le cartelle con il percorso dei file (in particalore la cartella che contiene il database), " +
                                "poi scegliere il file di dati .sqlite e premere 'Salva configurazione'", "SchoolGrades", MessageBoxButtons.OK, MessageBoxIcon.Information);
                FrmSetup f = new FrmSetup();
                f.ShowDialog();
                if (!File.Exists(Commons.PathAndFileDatabase))
                {
                    MessageBox.Show("Configurare il programma!", "SchoolGrades", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            //Application.Run(new frmLogin());
            Application.Run(new frmUsersManagement());
            Application.Run(new frmMain());
        }
Пример #2
0
        static void Main()
        {
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // read configuration file or run configuration
            if (!CommonsWinForms.ReadConfigFile())
            {
                // config file is unexistent or broken
                if (Commons.PathAndFileDatabase.Contains("DEMO") && File.Exists(Commons.PathAndFileDatabase))
                {
                    // if demo database exists, save the configuration program with demo file
                    WriteConfigFile();
                }
                else
                {
                    // we don't want the demo file or it doesn't exist. Let's ask the user
                    MessageBox.Show("Configurazione del programma.\r\nSistemare le cartelle con il percorso dei file (in particolare la cartella che contiene il database), " +
                                    "poi scegliere il file di dati .sqlite e premere 'Salva configurazione'", "SchoolGrades", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    FrmSetup f = new FrmSetup();
                    f.ShowDialog();
                    if (!File.Exists(Commons.PathAndFileDatabase))
                    {
                        MessageBox.Show("Configurare il programma!", "SchoolGrades", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
            else
            {
                // config file has been read
                // do nothing
            }

            // create Businnes and Data layer objects, to be used throughout the program
            // keep this order of creation. Create after reading config file
            Commons.dl = new DataLayer(Commons.PathAndFileDatabase);
            Commons.bl = new BusinessLayer(Commons.PathAndFileDatabase);

            //Application.Run(new frmLogin());
            Application.Run(new frmMain());
        }