Beispiel #1
0
        private async void Inicializar(string token)
        {
            try
            {
                securityContract = new BaseSecurityContract();
                User             = await securityContract.GetUser(token);

                this.Text = $"Bienvenido {User.DisplayName}";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Application.Exit();
            }
        }
Beispiel #2
0
        private async void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                BaseSecurityContract baseSecurity = new BaseSecurityContract();
                string token =
                    await baseSecurity.GetTokenUserAsync(txtUsername.Text, txtPassword.Text);

                if (token.LongCount() < 30)
                {
                    throw new Exception(token);
                }

                this.Hide();
                var frm = new Form1(token);
                frm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }