Beispiel #1
0
        public async void Validate(string device, string correo, string contrasena)
        {
            string Result;
            var    ValidationResultTextView = FindViewById <TextView>(Resource.Id.ValidationResultTextView);
            var    Builder       = new Notification.Builder(this);
            var    ServiceClient = new SALLab07.ServiceClient();

            Console.WriteLine($"{correo} | {contrasena}");
            var SvcResult = await ServiceClient.ValidateAsync(
                correo,
                contrasena,
                device);

            Result = $"{SvcResult.Status}\n{SvcResult.Fullname}\n{SvcResult.Token}";

            if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                Builder.SetContentTitle("Resultado de la Validación");
                Builder.SetContentText(Result);
                Builder.SetSmallIcon(Resource.Drawable.Icon);
                Builder.SetCategory(Notification.CategoryMessage);

                var ObjectNotification = Builder.Build();
                var Manager            = GetSystemService(
                    Android.Content.Context.NotificationService) as NotificationManager;
                Manager.Notify(0, ObjectNotification);
            }
            else
            {
                ValidationResultTextView.Text = Result;
            }
        }
Beispiel #2
0
        private async void Validate(String Correo, string Clave)
        {
            var TextValidator = FindViewById <TextView>(Resource.Id.TextValidator);

            SALLab07.ServiceClient ServiceClient = new
                                                   SALLab07.ServiceClient();

            string myDevice = Android.Provider
                              .Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId);

            SALLab07.ResultInfo Result = await
                                         ServiceClient.ValidateAsync(Correo, Clave, myDevice);

            string mensaje = ($"{Result.Status} \n{Result.Fullname}\n {Result.Token}");

            var Builder = new Notification.Builder(this).SetContentTitle("Validacion de la Actividad").
                          SetContentText(mensaje).SetSmallIcon(Resource.Drawable.Icon);

            if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                Builder.SetCategory(Notification.CategoryMessage);

                var ObjectNotification = Builder.Build();
                var Manager            = GetSystemService(Android.Content.Context.NotificationService) as NotificationManager;
                Manager.Notify(0, ObjectNotification);
            }
            else
            {
                TextValidator.Text = mensaje;
            }
        }
        async Task Validate(string correo, string pass)
        {
            SALLab07.ServiceClient ServiceClient = new SALLab07.ServiceClient();

            string StudentMail = correo;
            string Password    = pass;
            string myDevice    = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId);

            var Result = await ServiceClient.ValidateAsync(StudentMail, Password, myDevice);

            var TextViewValidacion = FindViewById <TextView>(Resource.Id.ValidacionTextView);
            var texto = $"{Result.Status}\n{Result.Fullname}\n{Result.Token}";

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                var Builder = new Notification.Builder(this)
                              .SetContentTitle("Validación de actividad")
                              .SetContentText(texto)
                              .SetSmallIcon(Resource.Drawable.Icon);

                Builder.SetCategory(Notification.CategoryMessage);

                var ObjectNotification = Builder.Build();
                var Manager            = GetSystemService(NotificationService) as NotificationManager;
                Manager.Notify(0, ObjectNotification);
            }
            else
            {
                TextViewValidacion.Text = texto;
            }
        }
Beispiel #4
0
        private async void Validar()
        {
            var client = new SALLab07.ServiceClient();

            var EmailText    = FindViewById <EditText>(Resource.Id.EmailText);
            var PasswordText = FindViewById <EditText>(Resource.Id.PasswordText);
            var myDevice     = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId);

            var result = await client.ValidateAsync(EmailText.Text, PasswordText.Text, myDevice);


            if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                var notificationText = $"{result.Status} {result.Fullname} {result.Token}";

                var builder = new Notification.Builder(this)
                              .SetContentTitle("Validacion de la Actividad")
                              .SetContentText(notificationText)
                              .SetSmallIcon(Resource.Drawable.Icon);

                builder.SetCategory(Notification.CategoryMessage);

                var ObjectNotifcation = builder.Build();
                var Manager           = GetSystemService(Android.Content.Context.NotificationService) as NotificationManager;
                Manager.Notify(0, ObjectNotifcation);
            }
            else
            {
                var message = $"{result.Status}\n{result.Fullname}\n{result.Token}";

                var resultText = FindViewById <TextView>(Resource.Id.ResultText);
                resultText.Text = message;
            }
        }
Beispiel #5
0
        public async void Validar(string email, string password, string device)
        {
            var sc       = new SALLab07.ServiceClient();
            var scResult = await sc.ValidateAsync(email, password, device);

            txtResult  = $"{scResult.Status}\n{scResult.Fullname}\n{scResult.Token}";
            txtResultB = $"{scResult.Status} {scResult.Fullname} {scResult.Token}";
        }
        private async Task ValidateActivity()
        {
            var client = new SALLab07.ServiceClient();
            var result = await client.ValidateAsync(txtCorreo.Text, txtPass.Text, new NorthWindModel.NorthWindModelClass());

            var Alert = UIAlertController.Create("Resultado", $"{result.Status} {result.FullName} {result.Token}", UIAlertControllerStyle.Alert);

            Alert.AddAction(UIAlertAction.Create("OK!", UIAlertActionStyle.Default, null));
            PresentViewController(Alert, true, null);
        }
Beispiel #7
0
        private async void AppValidate()
        {
            var Client = new SALLab07.ServiceClient();

            var result = await Client.ValidateAsync(Email, Password, Model);

            var message = $"{result.Status}\n{result.FullName}\n{result.Token}";

            this.Dialog.Show(message);
        }
Beispiel #8
0
        async void Validate()
        {
            var Client = new SALLab07.ServiceClient();
            var Result = await Client.ValidateAsync(txtEmail.Text, txtPassword.Text, Model);

            var Alert = UIAlertController.Create("Resultado",
                                                 $"{Result.Status}\n{Result.FullName}\n{Result.Token}",
                                                 UIAlertControllerStyle.Alert);

            Alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));

            PresentViewController(Alert, true, null);
        }
Beispiel #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ValidarButton.TouchUpInside += async(sender, e) => {
                var Client = new SALLab07.ServiceClient();
                var Result = await Client.ValidateAsync(CorreoText.Text, ContraText.Text, model);

                var Alert = UIAlertController.Create("Resultado", $"{Result.Status}\n{Result.FullName}\n{Result.Token}", UIAlertControllerStyle.Alert);
                Alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                PresentViewController(Alert, true, null);
            };
        }
Beispiel #10
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            var    ValidateButton = FindViewById <Button>(Resource.Id.ValidateButton);
            var    ResultView     = FindViewById <TextView>(Resource.Id.ResultView);
            var    EmailText      = FindViewById <EditText>(Resource.Id.EmailText);
            var    PasswordText   = FindViewById <EditText>(Resource.Id.PasswordText);
            string EMail;
            string Password;
            string Device = Android.Provider.Settings.Secure.GetString(
                ContentResolver, Android.Provider.Settings.Secure.AndroidId);

            ValidateButton.Click += (sender, e) =>
            {
                EMail    = EmailText.Text;
                Password = PasswordText.Text;
                Validate();
            };

            async void Validate()
            {
                string Result;

                var ServiceClient = new SALLab07.ServiceClient();
                var SvcResult     = await ServiceClient.ValidateAsync(EMail, Password, Device);

                Result = $"{SvcResult.Status}\n{SvcResult.Fullname}\n{SvcResult.Token}";

                if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
                {
                    var Builder = new Notification.Builder(this)
                                  .SetContentTitle("Validación de actividad")
                                  .SetContentText(Result)
                                  .SetSmallIcon(Resource.Drawable.Icon);
                    Builder.SetCategory(Notification.CategoryMessage);
                    var ObjectNotification = Builder.Build();
                    var Manager            = GetSystemService(
                        Android.Content.Context.NotificationService) as NotificationManager;
                    Manager.Notify(0, ObjectNotification);
                }
                else
                {
                    ResultView.Text = Result;
                }
            }
        }
Beispiel #11
0
        public async System.Threading.Tasks.Task <string> Validate()
        {
            SALLab07.ServiceClient client = new SALLab07.ServiceClient();
            string myD = Android.Provider.Settings.Secure.GetString(
                ContentResolver, Android.Provider.Settings.Secure.AndroidId);


            SALLab07.ResultInfo Result =
                await client.ValidateAsync(
                    StudentEmail, Password, myD);


            return($"{Result.Status}\n{Result.Fullname}\n{Result.Token}");
        }
Beispiel #12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            var textEmail    = FindViewById <EditText>(Resource.Id.textEmail);
            var textPass     = FindViewById <EditText>(Resource.Id.textPass);
            var btnValidar   = FindViewById <Button>(Resource.Id.btnValidar);
            var textVValidar = FindViewById <TextView>(Resource.Id.textVValidar);

            btnValidar.Click += async(sender, e) => {
                var ServiceClient = new SALLab07.ServiceClient();

                string StudentEmail = textEmail.Text;
                string Password     = textPass.Text;

                string myDevice = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId);

                var Result = await ServiceClient.ValidateAsync(StudentEmail, Password, myDevice);

                if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
                {
                    try
                    {
                        var Builder = new Notification.Builder(this);
                        Builder.SetContentTitle("Validación de actividad");
                        Builder.SetContentText($"{Result.Status} {Result.Fullname} {Result.Token}");
                        Builder.SetSmallIcon(Resource.Drawable.Icon);

                        Builder.SetCategory(Notification.CategoryMessage);

                        var ObjectNotification = Builder.Build();
                        var Manager            = GetSystemService(Android.Content.Context.NotificationService) as NotificationManager;
                        Manager.Notify(0, ObjectNotification);
                    }
                    catch {
                    }
                }

                else
                {
                    textVValidar.Text = $"{Result.Status}\n{Result.Fullname}\n{Result.Token}";
                }
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.layout1);
            var Mail       = FindViewById <EditText>(Resource.Id.Mail);
            var Password   = FindViewById <EditText>(Resource.Id.Password);
            var Validar    = FindViewById <Button>(Resource.Id.Validar);
            var ResultText = FindViewById <EditText>(Resource.Id.TextResult);

            Validar.Click += (sender, e) =>
            {
                validate();
            };
            async void validate()
            {
                SALLab07.ServiceClient ServiceClient = new SALLab07.ServiceClient();
                string StudentEmail = Mail.Text;     // correo de registro xamarin 3.0
                string Password1    = Password.Text; // password de registro

                string myDevice = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId);

                SALLab07.ResultInfo Result = await ServiceClient.ValidateAsync(StudentEmail, Password1, myDevice);

                if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
                {
                    string Mensaje = ($"{Result.Status}\n{Result.Fullname}\n{Result.Token}");
                    var    Builder = new Notification.Builder(this)
                                     .SetContentTitle("́Validación de la actividad")
                                     .SetContentText(Mensaje)
                                     .SetSmallIcon(Resource.Drawable.Icon);
                    Builder.SetCategory(Notification.CategoryMessage);
                    var ObjectNotification = Builder.Build();
                    var Manager            = GetSystemService(
                        Android.Content.Context.NotificationService) as NotificationManager;
                    Manager.Notify(0, ObjectNotification);
                }
                else
                {
                    Android.App.AlertDialog.Builder Builder = new AlertDialog.Builder(this);
                    ResultText.Text = ($"{Result.Status}\n{Result.Fullname}\n{Result.Token}");
                }
            }
        }
Beispiel #14
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            var btnValidade = FindViewById <Button>(Resource.Id.btnValidar);
            var txtEmail    = FindViewById <EditText>(Resource.Id.txtEmail);
            var txtPassword = FindViewById <EditText>(Resource.Id.txtPassword);
            var lblResponse = FindViewById <TextView>(Resource.Id.lblResult);

            btnValidade.Click += async delegate
            {
                if (string.IsNullOrWhiteSpace(txtEmail.Text) || string.IsNullOrWhiteSpace(txtPassword.Text))
                {
                    return;
                }

                SALLab07.ServiceClient client = new SALLab07.ServiceClient();
                var response = await client.ValidateAsync(txtEmail.Text,
                                                          txtPassword.Text, Android.Provider.Settings.Secure.GetString(ContentResolver,
                                                                                                                       Android.Provider.Settings.Secure.AndroidId));

                if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
                {
                    var builder = new Notification.Builder(this)
                                  .SetContentTitle("Validación de actividad")
                                  .SetContentText(
                        $"{response.Status} {response.Fullname} {response.Token}")
                                  .SetSmallIcon(Resource.Drawable.Icon);

                    builder.SetCategory(Notification.CategoryMessage);

                    var objectNotification = builder.Build();
                    var manager            = GetSystemService(NotificationService) as NotificationManager;
                    manager.Notify(0, objectNotification);
                }
                else
                {
                    lblResponse.Text =
                        $"{response.Status} \n{response.Fullname} \n{response.Token}";
                }
            };
        }
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.UserDataLayout);

            //Lab06A
            var MessageView    = FindViewById <TextView>(Resource.Id.ResultValidationTextView);
            var EmailEntry     = FindViewById <TextView>(Resource.Id.emailEntry);
            var PasswordEntry  = FindViewById <TextView>(Resource.Id.passwordEntry);
            var ValidateButton = FindViewById <Button>(Resource.Id.ValidateButton);

            var ServiceClient = new SALLab07.ServiceClient();

            ValidateButton.Click += async(object sender, System.EventArgs e) =>
            {
                string myDevice = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId);
                var    Result   = await ServiceClient.ValidateAsync(EmailEntry.Text, PasswordEntry.Text, myDevice);

                string result = $"{ Result.Status} { Result.Fullname} { Result.Token}";
                string title  = $"Validación de la actividad";
                if (Android.OS.Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop)
                {
                    var Builder = new Notification.Builder(this)
                                  .SetContentTitle(title)
                                  .SetContentText(result)
                                  .SetSmallIcon(Resource.Drawable.Icon);
                    Builder.SetCategory(Notification.CategoryMessage);
                    var ObjectNotification = Builder.Build();
                    var Manager            = GetSystemService(Android.Content.Context.NotificationService) as NotificationManager;

                    Manager.Notify(0, ObjectNotification);
                }
                else
                {
                    MessageView.Text = $"{ Result.Status}\n{ Result.Fullname}\n{ Result.Token}";
                }
            };
        }
        private async void ValidateJC()
        {
            var miCorreo    = FindViewById <EditText>(Resource.Id.txtEmail);
            var miPassword  = FindViewById <EditText>(Resource.Id.txtPassword);
            var miResultado = FindViewById <TextView>(Resource.Id.lbValidateResult);

            string StudentEmail    = miCorreo.Text.Trim();
            string PasswordStudent = miPassword.Text.Trim();
            string resultadoFin    = "";

            string myDevice = Android.Provider.Settings.Secure.GetString(
                ContentResolver,
                Android.Provider.Settings.Secure.AndroidId);

            var ServiceClient = new SALLab07.ServiceClient();
            var Result        = await ServiceClient.ValidateAsync(StudentEmail, PasswordStudent, myDevice);

            resultadoFin     = $"{Result.Status}\n{Result.Fullname}\n{Result.Token}"; //resultadoFin = "prueba";
            miResultado.Text = "";

            if ((Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop))
            {
                var Builder = new Notification.Builder(this)
                              .SetContentTitle("Validacion de Actividad")
                              .SetContentText(resultadoFin) //resultadoFin
                              .SetSmallIcon(Resource.Drawable.Icon);

                Builder.SetCategory(Notification.CategoryMessage);
                var ObjectNotification = Builder.Build();
                var Manager            = GetSystemService(
                    Android.Content.Context.NotificationService) as NotificationManager;
                Manager.Notify(0, ObjectNotification);
            }
            else
            {
                miResultado.Text = resultadoFin;
            }
        }
Beispiel #17
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            var PhoneNumberText   = FindViewById <EditText>(Resource.Id.PhoneNumerText);
            var TranslateButton   = FindViewById <Button>(Resource.Id.TranslateButton);
            var CallButton        = FindViewById <Button>(Resource.Id.CallButton);
            var CallHistoryButton = FindViewById <Button>(Resource.Id.CallHistoryButton);
            var Validar           = FindViewById <Button>(Resource.Id.Validar);
            var ResultText        = FindViewById <EditText>(Resource.Id.TextResult);

            CallButton.Enabled = false;
            var TranslatedNumber = string.Empty;

            TranslateButton.Click += (object sender, System.EventArgs e) =>
            {
                var Translator = new PhoneTranslator();
                TranslatedNumber = Translator.ToNumber(PhoneNumberText.Text);
                if (string.IsNullOrWhiteSpace(TranslatedNumber))
                {
                    //No hay número a llamar
                    CallButton.Text    = "Llamar";
                    CallButton.Enabled = false;
                }
                else
                {
                    //Hay un posible numero telefonico a llamar
                    CallButton.Text    = $"Llamar al {TranslatedNumber}";
                    CallButton.Enabled = true;
                }
            };
            CallButton.Click += (object sender, System.EventArgs e) =>
            {
                //intenta marcar el numero telefonico
                var CallDialog = new AlertDialog.Builder(this);
                CallDialog.SetMessage($"Llamar al número{TranslatedNumber}?");
                CallDialog.SetNeutralButton("llamar", delegate
                {
                    //Agregar  el número marcado a la lista de números marcados
                    PhoneNumbers.Add(TranslatedNumber);
                    //Habilitar el boton HistoryButton
                    CallHistoryButton.Enabled = true;

                    //crear un intento para marcar el numero telefonico
                    var CallIntent =
                        new Android.Content.Intent(Android.Content.Intent.ActionCall);
                    CallIntent.SetData(
                        Android.Net.Uri.Parse($"tel:{TranslatedNumber}"));
                    StartActivity(CallIntent);
                });
                CallDialog.SetNegativeButton("Cancelar", delegate { });
                //mostrar el cuadro de dialogo al usuario y esperar una respuesta.
                CallDialog.Show();
                //validate();
                //CallButton.Enabled = false;
            };
            CallHistoryButton.Click += (sender, e) =>
            {
                var Intent = new Android.Content.Intent(this,
                                                        typeof(CallHistoryActivity));
                Intent.PutStringArrayListExtra("phone_numbers",
                                               PhoneNumbers);
                StartActivity(Intent);
            };
            Validar.Click += (sender, e) =>
            {
                SetContentView(Resource.Layout.layout1);
            };
            async void validate()
            {
                SALLab07.ServiceClient ServiceClient = new SALLab07.ServiceClient();
                string StudentEmail = "*****@*****.**";
                string Password     = "******";
                string myDevice     = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId);

                SALLab07.ResultInfo Result = await ServiceClient.ValidateAsync(StudentEmail, Password, myDevice);

                Android.App.AlertDialog.Builder Builder = new AlertDialog.Builder(this);
                ResultText.Text = ($"{Result.Status}\n{Result.Fullname}\n{Result.Token}");
            }
        }