private async void Validate() { service = new ServiceClient(); dataStudent = Intent.GetStringArrayExtra("dataStudent"); if (dataStudent == null) { result = await service.AutenticateAsync( FindViewById <EditText>(Resource.Id.etEmail).Text, FindViewById <EditText>(Resource.Id.etPassword).Text); LabItem labItem = new LabItem() { Email = FindViewById <EditText>(Resource.Id.etEmail).Text, Lab = "Hack@Home", DeviceId = Settings.Secure.GetString(ContentResolver, Settings.Secure.AndroidId) }; MicrosoftServiceClient microsoftClient = new MicrosoftServiceClient(); await microsoftClient.SendEvidence(labItem); } if ((result != null && result.Status == Status.Success) || dataStudent != null) { if (dataStudent == null) { dataStudent = new string[2]; } dataStudent[0] = result != null ? result.Token : dataStudent[0]; dataStudent[1] = result != null ? result.FullName : dataStudent[1]; Intent intent = new Intent(this, typeof(listItemActivity)); intent.PutExtra("dataStudent", dataStudent); StartActivity(intent); } }
private async void AuthenticateService() { AuthenticateService service = new AuthenticateService(); var result = await service.AutenticateAsync(txtEmail.Text, txtPassword.Text); if (result.Status == Status.Success) { var MicrosoftEvidence = new LabItem { Email = txtEmail.Text, DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId), Lab = "Hack@Home" }; MicrosoftServiceClient mService = new MicrosoftServiceClient(); var intent = new Intent(this, typeof(EvidenceActivity)); intent.PutExtra("Token", result.Token); intent.PutExtra("Name", result.FullName); StartActivity(intent); await mService.SendEvidence(MicrosoftEvidence); } else { Android.App.AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog Alert = builder.Create(); Alert.SetTitle("Resultado de la verificación"); Alert.SetIcon(Resource.Drawable.Icon); Alert.SetMessage($"{result.Status}\n{result.FullName}\n{result.Token}"); Alert.SetButton("Ok", (s, ev) => { }); Alert.Show(); } }
private async void ValidateButton_Click(object sender, System.EventArgs e) { var serviceClient = new ServiceClient(); var studentEmail = EmailText.Text; var studentPassword = PasswordText.Text; var result = await serviceClient.AutenticateAsync(studentEmail, studentPassword); var microsoftEvidence = new LabItem { Email = EmailText.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure .GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var microsoftServiceClient = new MicrosoftServiceClient(); await microsoftServiceClient.SendEvidence(microsoftEvidence); if (result.Status == Entities.Status.AllSuccess || result.Status == Entities.Status.Success) { var intent = new Intent(this, typeof(EvidencesActivity)); intent.PutExtra(USERNAME, result.FullName); intent.PutExtra(TOKEN, result.Token); StartActivity(intent); } else { Toast.MakeText(this, "Error al autenticar", ToastLength.Short).Show(); } }
private async void Validate(string StudentEmail, string Password) { LabItem LabItem = new LabItem { Email = LoginData[0], Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) //,Id = EventID }; var ServiceClient = new ServiceClient(); var Result = await ServiceClient.AutenticateAsync(StudentEmail, Password); //ListEvidence = FindViewById<ListView>(Resource.Id.listView1); Data.Alumno = Result.FullName; Data.Token = Result.Token; Data.Lista = await ServiceClient.GetEvidencesAsync(Result.Token); ListEvidence.Adapter = new EvidencesAdapter(this, Data.Lista, Resource.Layout.ListItem, Resource.Id.textViewEvidencia, Resource.Id.textViewEstado); Data.Adapter = ListEvidence.Adapter; textViewAlumno.Text = Result.FullName; var MicrosoftServiceClient = new MicrosoftServiceClient(); await MicrosoftServiceClient.SendEvidence(LabItem); }
private async void BtnValidate_Click(object sender, System.EventArgs e) { ServiceClient sc = new ServiceClient(); ResultInfo resulInfo = new ResultInfo(); EditText email = FindViewById <EditText>(Resource.Id.editTextEmail); EditText password = FindViewById <EditText>(Resource.Id.editTextPassword); resulInfo = await sc.AutenticateAsync(email.Text, password.Text); if (resulInfo.Status == Status.Success) { var MicrosoftEvidence = new LabItem() { DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId), Email = email.Text, Lab = "Hack@Home" }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); var intent = new Android.Content.Intent(this, typeof(EvidencesActivity)); intent.PutExtra("Token", resulInfo.Token); intent.PutExtra("FullName", resulInfo.FullName); StartActivity(intent); } else { MuestraMensaje("No se pudo autenticar \n en TI Capacitación."); } }
private async void ValidateButton_Click(object sender, System.EventArgs e) { var email = emailEditText.Text; var password = passwordEditText.Text; emailEditText.Enabled = false; passwordEditText.Enabled = false; var serviceClient = new ServiceClient(); var result = await serviceClient.AutenticateAsync(email, password); if (result.Status == Status.Success || result.Status == Status.AllSuccess) { string deviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId); var microsotClient = new MicrosoftServiceClient(); await microsotClient.SendEvidence(new LabItem { DeviceId = deviceId, Email = email, Lab = "Hack@Home" }); var newIntent = new Android.Content.Intent(this, typeof(EvidenceActivity)); newIntent.PutExtra("FullName", result.FullName); newIntent.PutExtra("Token", result.Token); StartActivity(newIntent); emailEditText.Text = string.Empty; passwordEditText.Text = string.Empty; emailEditText.Enabled = true; passwordEditText.Enabled = true; } else { int messageId; switch (result.Status) { case Status.InvalidUserOrNotInEvent: messageId = Resource.String.InvalidUserOrNotInEvent_Authentication; break; case Status.OutOfDate: messageId = Resource.String.OutOfDate_Authentication; break; case Status.Error: default: messageId = Resource.String.Error_Authentication; break; } new Android.App.AlertDialog.Builder(this) .SetMessage(this.Resources.GetString(messageId)) .SetPositiveButton("OK", delegate { }) .Show(); emailEditText.Enabled = true; passwordEditText.Enabled = true; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); //Variables de UI: var etEmail = FindViewById <EditText>(Resource.Id.etEmail); var etPassword = FindViewById <EditText>(Resource.Id.etPassword); var btnValidar = FindViewById <Button>(Resource.Id.btnValidar); //Evento de click al botón: btnValidar.Click += async(sender, e) => { //Autenticación en TI Capacitacion: var client = new ServiceClient(); var result = await client.AutenticateAsync(etEmail.Text, etPassword.Text); //Verificar el estado de la autenticación: switch (result.Status) { case Status.Error: //Error: CrearDialogo(0); break; case Status.Success: //Success: //Envio de evidencia e intent: var MicrosoftEvidence = new LabItem { Email = etEmail.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); var intent = new Intent(this, typeof(EvidencesActivity)); intent.PutExtra("token", result.Token); intent.PutExtra("name", result.FullName); StartActivity(intent); break; case Status.InvalidUserOrNotInEvent: //InvalidUserOrNotInEvent CrearDialogo(2); break; case Status.OutOfDate: CrearDialogo(3); break; } }; }
private async void validarMicrosoft(string correoEstudiante) { var microsoftServiceClient = new MicrosoftServiceClient(); var labItem = new LabItem { Email = correoEstudiante, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; await microsoftServiceClient.SendEvidence(labItem); }
/// Método para enviar la evidencia a Microsoft public async void SendEvidence(string email) { var MicrosoftEvidence = new LabItem { Email = email, Lab = "@string/ApplicationName", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); }
private async void SendEvidence() { var microsoftClient = new MicrosoftServiceClient(); LabItem microsoftEvidence = new LabItem() { Email = _userInfo.Email, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; await microsoftClient.SendEvidence(microsoftEvidence); }
private async void Validate() { ServiceClient ServiceClient = new ServiceClient(); var emailEditText = FindViewById <EditText>(Resource.Id.editTextEmail); var passwordEditText = FindViewById <EditText>(Resource.Id.editTextPassword); ResultInfo Result = await ServiceClient.AutenticateAsync(emailEditText.Text, passwordEditText.Text); var MicrosoftEvidence = new LabItem { Email = emailEditText.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); // Creamos un dialogo para mostrar el resultado de la validacion Android.App.AlertDialog.Builder Builder = new AlertDialog.Builder(this); AlertDialog Alert = Builder.Create(); Alert.SetTitle("Resultado de la Validación"); Alert.SetIcon(Resource.Drawable.hath_icon); // Mostramos un mensaje personalizado string message; if (Result.Status == Status.Success || Result.Status == Status.AllSuccess) { message = $"Bienvenido {Result.FullName}"; } else { message = $"Error:\n{Result.Status}\n{Result.FullName}"; } // Finalizamos el dialogo y al precionar el boton OK si todo fue satisfactorio pasamos a la otra actividad Alert.SetMessage(message); Alert.SetButton("Ok", (s, ev) => { if (Result.Status == Status.Success || Result.Status == Status.AllSuccess) { var Intent = new Android.Content.Intent(this, typeof(EvidenceListActivity)); Intent.PutExtra("FullName", Result.FullName); Intent.PutExtra("Token", Result.Token); StartActivity(Intent); } }); Alert.Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); var BtnValidate = FindViewById <Button>(Resource.Id.buttonValidate); var UserMail = FindViewById <EditText>(Resource.Id.EditTextEmail); var UserPass = FindViewById <EditText>(Resource.Id.EditTextPassword); BtnValidate.Click += async(object sender, System.EventArgs e) => { BtnValidate.Enabled = false; string StudentEmail = UserMail.Text; string StudentPassword = UserPass.Text; if (!string.IsNullOrEmpty(StudentEmail) && !string.IsNullOrEmpty(StudentPassword)) { ServiceClient ServiceClient = new ServiceClient(); ResultInfo Result = await ServiceClient.AutenticateAsync(StudentEmail, StudentPassword); if (Result.Status == Status.Success) { var MicrosoftEvidence = new LabItem { Email = StudentEmail, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; MicrosoftServiceClient MicrosoftService = new MicrosoftServiceClient(); await MicrosoftService.SendEvidence(MicrosoftEvidence); var EvidenceIntent = new Android.Content.Intent(this, typeof(EvidenceActivity)); EvidenceIntent.PutExtra("Token", Result.Token); EvidenceIntent.PutExtra("UserName", Result.FullName); StartActivity(EvidenceIntent); UserMail.Text = string.Empty; UserPass.Text = string.Empty; } else { string ErrorMessageAuth = GetString(Resource.String.ErrorLogin); var ErrorDialog = new AlertDialog.Builder(this); ErrorDialog.SetMessage(ErrorMessageAuth); ErrorDialog.SetNegativeButton(GetString(Resource.String.Ok), delegate { }); ErrorDialog.Show(); } BtnValidate.Enabled = true; } }; }
// Codigo de Luis Beltran protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); var edtCorreo = FindViewById <EditText>(Resource.Id.edtCorreo); var edtPassword = FindViewById <EditText>(Resource.Id.edtPassword); var ValidateButton = FindViewById <Button>(Resource.Id.ValidateButton); ValidateButton.Click += async(s, e) => { try { var ServiceClient = new ServiceClient(); string StudentEmail = edtCorreo.Text; string Password = edtPassword.Text; var Result = await ServiceClient.AutenticateAsync(StudentEmail, Password); if (Result.Status == Status.Success) { var MicrosoftServiceClient = new MicrosoftServiceClient(); LabItem item = new LabItem() { DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId), Email = StudentEmail, Lab = "Hack@Home" }; await MicrosoftServiceClient.SendEvidence(item); var Intent = new Android.Content.Intent(this, typeof(EvidencesActivity)); Intent.PutExtra("token", Result.Token); Intent.PutExtra("fullname", Result.FullName); Intent.PutExtra("email", StudentEmail); StartActivity(Intent); } else { Toast.MakeText(this, $"Error: {Result.Status}", ToastLength.Long); } } catch (System.Exception ex) { } }; }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.DetalleEvidencia); var nombreCompleto = FindViewById <TextView>(Resource.Id.TextViewItemNombre); nombreCompleto.Text = Intent.GetStringExtra("Nombre"); var token = Intent.GetStringExtra("Token"); var evidenciaId = Intent.GetIntExtra("EvidenceID", 0); var titulo = Intent.GetStringExtra("Title"); var estado = Intent.GetStringExtra("Status"); var service = new HackAtHome.SAL.ServiceClient(); var evidencia = await service.GetEvidenceByIDAsync(token, evidenciaId); var tituloText = FindViewById <TextView>(Resource.Id.TextViewEvidenciaItemTitulo); tituloText.Text = titulo; var description = FindViewById <WebView>(Resource.Id.evidenceDescription); description.LoadDataWithBaseURL(null, evidencia.Description, "text/html", "utf-8", null); var estadoText = FindViewById <TextView>(Resource.Id.TextViewEvidenciaEstadoItem); estadoText.Text = estado; var imagen = FindViewById <ImageView>(Resource.Id.ImageViewEvidenciaItem); Koush.UrlImageViewHelper.SetUrlDrawable(imagen, evidencia.Url); var microsoftEvidence = new LabItem { Email = "*****@*****.**", Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var microsoftClient = new MicrosoftServiceClient(); await microsoftClient.SendEvidence(microsoftEvidence); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var ButtonValidate = FindViewById <Button>(Resource.Id.buttonValidate); ButtonValidate.Click += async(object sender, System.EventArgs e) => { var EditTextEmail = FindViewById <TextView>(Resource.Id.editTextEmail); var EditTextPassword = FindViewById <TextView>(Resource.Id.editTextPassword); var TiCapacitacionClient = new ServiceClient(); var Result = await TiCapacitacionClient.AutenticateAsync(EditTextEmail.Text, EditTextPassword.Text); if (Result.Status == Status.Success) { var MicrosoftEvidence = new LabItem { Email = EditTextEmail.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); var Intent = new Android.Content.Intent(this, typeof(EvidencesActivity)); Intent.PutExtra("Token", Result.Token); Intent.PutExtra("FullName", Result.FullName); StartActivity(Intent); } else { Android.App.AlertDialog.Builder Builder = new AlertDialog.Builder(this); AlertDialog Alert = Builder.Create(); Alert.SetTitle("Resultado de la verificación"); Alert.SetIcon(Resource.Drawable.Icon); Alert.SetMessage($"{Enum.GetName(typeof(Status), Result.Status)}"); Alert.SetButton("Ok", (s, ev) => { }); Alert.Show(); } }; }
private async void Validate() { ServiceClient serviceclient = new ServiceClient(); var emailEditText = FindViewById <EditText>(Resource.Id.editTextCorreo); var passwordEditText = FindViewById <EditText>(Resource.Id.editTextPassword); ResultInfo Result = await serviceclient.AutenticateAsync(emailEditText.Text, passwordEditText.Text); var MicrosoftEvidence = new LabItem { Email = emailEditText.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); Android.App.AlertDialog.Builder Builder = new AlertDialog.Builder(this); AlertDialog Alert = Builder.Create(); Alert.SetTitle("Resultado de la verificacion"); Alert.SetIcon(Resource.Drawable.icon); string message; if (Result.Status == Status.Success || Result.Status == Status.AllSuccess) { message = $"Bienvenido {Result.FullName}"; } else { message = $"Error:\n{Result.Status}\n{Result.FullName}"; } var Intent = new Android.Content.Intent(this, typeof(EvidenceListActivity)); Intent.PutExtra("FullName", Result.FullName); Intent.PutExtra("Token", Result.Token); StartActivity(Intent); }
private async void Validar_Click(object sender, System.EventArgs e) { var Email = FindViewById <EditText>(Resource.Id.txtEmail); var Pass = FindViewById <EditText>(Resource.Id.txtPass); var Result = await serviceCliente.AutenticateAsync(Email.Text, Pass.Text); var intent = new Android.Content.Intent(this, typeof(ListaLabs)); intent.PutExtra("dato", Result.FullName); intent.PutExtra("token", Result.Token); StartActivity(intent); //Evidencia del HackAtHome var MicrosoftEvidence = new LabItem { Email = Email.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId), }; var MicrosoftCliente = new MicrosoftServiceClient(); await MicrosoftCliente.SendEvidence(MicrosoftEvidence); }
private async void validate(string usuario, string clave) { ResultInfo resultInfo; resultInfo = await new ServiceClient().AutenticateAsync(usuario, clave); var MicrosoftEvidence = new LabItem() { Email = usuario, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId ) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); if (resultInfo.Status == Status.Success) { Intent button_login = new Intent(this, typeof(ListaEvidenciasActivity)); button_login.PutExtra("infoUsuario", HelperSAL.Serializar(resultInfo)); StartActivity(button_login); } }
private async void SendEvidence(string email) { MicrosoftServiceClient client = new MicrosoftServiceClient(); await client.SendEvidence(new LabItem { Email = email, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }); }