コード例 #1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            using (FormLogin login = new FormLogin())
            {
                login.StartPosition = FormStartPosition.CenterScreen;
                if (login.ShowDialog() == DialogResult.OK)
                {
                    string username = login.Username;
                    string password = login.Password;
                    if (AppConfig.Instance.ValidateLogin(username, password))
                    {
                        FullScreen.SetWinFullScreen(this.Handle);

                        lblCompanyName.Text    = AppConfig.Instance.CompanyName;
                        lblCompanyAddress.Text = AppConfig.Instance.CompanyAddress + " (" +
                                                 AppConfig.Instance.CompanyPhoneNumber + ")";
                        lblGateName.Text = AppConfig.Instance.GateName;

                        OpenVideoPlayer();
                        OpenSerialPort();
                    }
                    else
                    {
                        MessageBox.Show("Username atau password salah", "Gagal Login",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Close();
                    }
                }
                else
                {
                    Close();
                }
            }
        }