예제 #1
0
        static void Main()
        {
            const string appName = "QLKB";
            bool         createdNew;

            mutex = new Mutex(true, appName, out createdNew);
            if (!createdNew)
            {
                string message = "Chương trình <" + appName + "> đang chạy ! Vui lòng thoát chương trình đang chạy trước đó.";
                MessageBox.Show(message);
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Helper helper = new Helper();

            Splasher.Show(typeof(SplashScreenFrm));
            Splasher.Status = "Đang khởi tạo camera ...";
            initCamera();

            FingerPrint print = new FingerPrint();

            Splasher.Status = "Đang khởi tạo dữ liệu...";
            //Check key license
            string inputString     = print.GenKey(print.cpuId() + print.baseId());
            string keyGen          = print.GenKey(helper.RemoveWhitespace(inputString));
            string softwareLicense = Settings.Default.softwareLicense;

            Session.Instance.ActiveLicense = string.Equals(keyGen, softwareLicense);
            Settings.Default.ClientId      = inputString;
            Settings.Default.Save();

            //check database connection
            if (!DBConnection.Instance.OpenConnection())
            {
                Splasher.Close();
                Application.Run(new ConfigDB());
            }
            else
            {
                int dbVersion = helper.getDbVersion();
                if (dbVersion < DB_VERSION)
                {
                    ConfigDB configDb = new ConfigDB();
                    configDb.upgradeDB(DB_VERSION);
                }
                Application.Run(new Login());
            }
        }
예제 #2
0
 public Login()
 {
     InitializeComponent();
     Splasher.Close();
     helper = new Helper();
 }