Example #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (LicenceBLL.ValidateKey(txtLicence.Text))
            {
                // Save licence
                StreamWriter writer = new StreamWriter("licence.bbk");
                writer.Write(LicenceBLL.GenerateKey());
                writer.Flush();
                writer.Close();

                ShowSuccessMessage("GeoDiv đã được kích hoạt thành công!");
                DialogResult = DialogResult.OK;
                Close();
            }
            else
            {
                ShowErrorMessage("Mã kích hoạt không hợp lệ!");
            }
        }
Example #2
0
        public MainForm()
        {
            // Check connection to database
            GeoViewerEntities context = null;

            try
            {
                context = new GeoViewerEntities();
                var list = context.Accounts.Count();
            }
            catch (Exception)
            {
                if (context != null)
                {
                    context.Dispose();
                }
                if (new SetupDatabase().ShowDialog() != DialogResult.OK)
                {
                    Environment.Exit(0);
                }
            }
            // Check licence
            if (!LicenceBLL.ValidateKey())
            {
                if (new AddLicenceForm().ShowDialog() != DialogResult.OK)
                {
                    Environment.Exit(0);
                }
            }

            connectedToDatabase = true;
            MainApplicationForm = this;
            InitializeComponent();
            // Check connection to database

            // Run background process
            ReaderThreadManager.Current.InitThreads();
            ReaderThreadManager.Current.StartThreads();
        }