Ejemplo n.º 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            sqlite_connector con = new sqlite_connector();

            con.open();
            int amount_users = Convert.ToInt32(
                con.select(@"select count(id_user) from users;")
                .Tables[0].Rows[0].ItemArray[0].ToString());

            con.close();

            string registered_user;

            //if we have 0 users, then prompt the user to generate the root account

            User.Login u_login = new User.Login();
            if (amount_users < 1)
            {
                if (first_time_run())
                {
                    registered_user = u_login.username;
                    Application.Run(new User.Register(u_login, true));
                    if (u_login.username != null)
                    {
                        Application.Run(u_login);
                        if (u_login.login_ok)
                        {
                            Application.Run(new MainMenu.MainMenu(u_login.login_id));
                        }
                    }
                }
            }
            else
            {
                Application.Run(u_login);
                if (u_login.login_ok)
                {
                    Application.Run(new MainMenu.MainMenu(u_login.login_id));
                }
            }
        }